Created
October 30, 2024 14:28
-
-
Save Pelirrojo/80761aac61fe75bbeab1c891dab3b7ac to your computer and use it in GitHub Desktop.
Phase 2: Enhanced Protection | Add Geographic Restrictions in CloudFront
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A vantablack friday: How to be prepared to stop DDoS Attacks after Halloween | |
# https://blog.evereven.tech | |
# Obtain distribution ID | |
aws cloudfront list-distributions --query 'DistributionList.Items[*].Id' --output json | |
> [ | |
> "E1PI*******PNY" | |
> ] | |
# Obtain codes from: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 | |
cat > config.json << 'EOL' | |
{ | |
"Restrictions": { | |
"GeoRestriction": { | |
"RestrictionType": "blacklist", | |
"Locations": ["XX", "YY", "ZZ"] | |
} | |
} | |
} | |
EOL | |
# Overload cloudfront configuracion (replace [YOUR_DISTRIBUTION_ID] with the distribution id) | |
aws cloudfront update-distribution --id [YOUR_DISTRIBUTION_ID] --distribution-config file://config.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment