Skip to content

Instantly share code, notes, and snippets.

@holly
Forked from kozakana/cloud_front_ips.sh
Created June 5, 2022 15:01
Show Gist options
  • Save holly/821a5fd2d409a2cd01a0a8f7ec255b5b to your computer and use it in GitHub Desktop.
Save holly/821a5fd2d409a2cd01a0a8f7ec255b5b to your computer and use it in GitHub Desktop.
CloudFrontのIPアドレスを取得してnginxのset_real_ip_fromの形式で出力
curl -s "https://ip-ranges.amazonaws.com/ip-ranges.json" |jq -r '.prefixes | map(select(.service == "CLOUDFRONT").ip_prefix) | "set_real_ip_from" + " " + .[] + ";"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment