Skip to content

Instantly share code, notes, and snippets.

@jenseickmeyer
Created January 31, 2018 07:22
Show Gist options
  • Save jenseickmeyer/d1d7145b005618477680db3a39953eda to your computer and use it in GitHub Desktop.
Save jenseickmeyer/d1d7145b005618477680db3a39953eda 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