Last active
October 6, 2023 11:32
-
-
Save dansalias/6ead9805f72da9aff1201d775e695152 to your computer and use it in GitHub Desktop.
Invalidate an AWS CloudFront Distribution by domain name
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
#!/bin/bash | |
# get the CloudFront Id | |
CF_DISTRIBUTION_ID=$(aws cloudfront list-distributions \ | |
--query "DistributionList.Items[?contains(Aliases.Items[0], "example.com")] | [0].Id" \ | |
--output text | |
) | |
# invalidate all paths | |
aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --paths "/*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment