Skip to content

Instantly share code, notes, and snippets.

@nobiit
Created January 15, 2025 15:09
Show Gist options
  • Select an option

  • Save nobiit/4383f9423f3326fd7283fefb4b761b8d to your computer and use it in GitHub Desktop.

Select an option

Save nobiit/4383f9423f3326fd7283fefb4b761b8d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
REGIONS="GLOBAL,ap-east-1,ap-southeast-1"
SERVICES="CLOUDFRONT"
curl -fsL https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '($regions_raw | split(",")) as $regions | ($services_raw | split(",")) as $services | .prefixes[] | select(.region as $region | $regions | contains([$region])) | select(.service as $service | $services | contains([$service])) | "add address=\(.ip_prefix) comment=\"aws/\(.region | ascii_downcase)/\(.service | ascii_downcase)\" list=aws_net"' --arg regions_raw "${REGIONS}" --arg services_raw "${SERVICES}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment