Official AWS for Github Actions
Push to S3 and invalidate Cloudfront with every merge
I am a sucker for CI/CD pipelines. I pretty much build those out before I build any other project, to be honest. Ever since Github came out with workflow and actions I have been all over it!
Instead of relying on some online rando’s actions, I went straight to the source. AWS created and support their own Github actions. AND on top of that, Github actually comes pre-installed with AWS CLI now.
I just wanted to simply update an S3 bucket and invalidate my Cloudfront for the bucket.
First, we configure our credentials using the Github Action provided by AWS engineers, — doing God’s work.
Secondly, we then run AWS CLI like we normally would.
TL;DR
- Github workflow containers come pre-installed with AWS CLI
- AWS has its own project of AWS CLI actions to use
- Above is how to update an S3 bucket and invalidate the objects in the connected Cloudfront distribution
If you want to learn how to set up an S3 Bucket to Cloudfront for hosting then read my tutorial here.