Cloudfront not invalidating
I also wanted to add this to my deploy script so I wouldn’t have to manually go into the Cloud Front management console.
Luckily for us, the command line tools offer invalidation support with the create-invalidation command: Simply replace $CLOUDFRONT_ID with your Cloud Front distribution ID.
As your site is accessed going forward, Cloud Front will start caching the content you invalidated again as it is requested, and all will be right with the world in time.
Sometimes, you don’t want to personally “click-click-type-click” your way through the Console to trigger an invalidation.
For instance during a new UI update, if a CSS file were to take 12 hours to propagate into the caches, but the layout changes only take 4 hours, there would be 8 hours where the new layout isn’t properly styled.
Also, you can use wildcards to take out entire roots, directories, etc.To flush out this old stuff, we will want to clear out the cache – the AWS Cloud Front term for this is an “invalidation.” This is more than a nit-pick, because we invoke the “create-invalidation” command / SDK method in order to go about doing it.Invalidations are executed against a specific Cloud Front Distribution.This can be done from the AWS Management Console easily enough; I’m going to step through that quickly to introduce the basics that will help explain how to execute the functionality programmatically.You have to have the authorization to take these actions I am about to describe.