If you are using CloudFront distribution to serve your users, it will be good to be able to automate cache invalidation by using this command:
Replace stackName with the name of your Cloudformation stack.
distributionId=$(aws cloudformation describe-stacks --stack-name stackName --query "Stacks[0].Outputs[?OutputKey=='DistributionId'].OutputValue" --output text)
echo distributionId
aws cloudfront create-invalidation --distribution-id $distributionId --paths "/*"
Top comments (0)