LoginSignup
0
0

More than 5 years have passed since last update.

[AWS][CloudFront] 既存の CloudFront をまとめて IPv6 Enabled に変更する

Posted at

aws-cli でやるなら、こんな感じ

update-distribution.sh
#!/bin/bash
DIST_IDS=$(aws cloudfront list-distributions | jq -r '.DistributionList.Items[] | select(.IsIPV6Enabled == false) | .Id')
for DIST_ID in ${DIST_IDS}; do
    ETAG=$(aws cloudfront get-distribution --id ${DIST_ID} | jq -r '.ETag')
    CONFIG_JSON=$(mktemp)
    jq -s '.[0] * .[1]' <(aws cloudfront get-distribution --id "${DIST_ID}" | jq '.Distribution.DistributionConfig') <(echo '{"IsIPV6Enabled": true}') > ${CONFIG_JSON}
    aws cloudfront update-distribution --id ${DIST_ID} --distribution-config file://${CONFIG_JSON} --if-match ${ETAG}
    rm -f ${CONFIG_JSON}
done
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0