CloudFrontがHTTP/3に対応したのを一括対応する

Amazon CloudFront が QUIC を利用した HTTP/3 のサポートを開始

これに一括で対応するヤツ。

distributions=($(aws cloudfront list-distributions|jq --arg httpVersion 'HTTP2' -r '.DistributionList.Items[]|select(.HttpVersion == $httpVersion)|.Id'))

echo "============="
echo "Distributions"
echo "============="
printf "%s\n" "${distributions[@]}"

echo "============="
echo "Results"
echo "============="

for i in "${distributions[@]}"
do
  previous=$(aws cloudfront get-distribution-config --id $i)
  update=$(echo "$previous" | sed "s/http2/http2and3/" | jq '.DistributionConfig')
  result=$(aws cloudfront update-distribution --id $i --distribution-config "$update" --if-match $(echo "$previous" | jq -r '.ETag'))
  echo "$(echo $result | jq -r '.Distribution.Id + ": " + .Distribution.Status')"
done