Skip to content

Instantly share code, notes, and snippets.

@team55
Forked from jenseickmeyer/invalidate.sh
Created July 1, 2022 13:42
Show Gist options
  • Save team55/7bcc596608cdb30c6eedded682942cd8 to your computer and use it in GitHub Desktop.
Save team55/7bcc596608cdb30c6eedded682942cd8 to your computer and use it in GitHub Desktop.
Script for invalidation a CloudFront Distribution
#!/bin/bash
DISTRIBUTION_ID=
#Invalidate the CloudFront Distribution
invalidation_id=$(aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" --query Invalidation.Id)
length=${#invalidation_id}
# Wait for invalidation to finish
aws cloudfront wait invalidation-completed --distribution-id $DISTRIBUTION_ID --id ${invalidation_id:1:$length-2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment