Notes and anecdotes

Techstuff rambling

AWS S3 and CloudFront workshop

Last week, I held an AWS workshop on how to host a (dummy) React app there, in S3 and with CloudFront. If you’d like to learn what I taught the others, a github repo is available at https://github.com/tomfa/aws-frontend-workshop.

Add S3 bucket + CloudFront using Terraform (example)

Case: I have some frontend app that consists of static files, e.g. a React app packed with WebPack. I want to deploy it to S3, with CloudFront in front of it. (Optional) I also want index.html to be rendered when other paths are requested (such as /food/cake-is-best), and for the site to return 200 status instead of 404.

Set index.html as default file on S3 bucket

aws s3 website $MY_BUCKET_NAME –index-document index.html

Add S3 bucket using awscli (example)

Here’s a simple step by step guide on how to create a s3 bucket, with an attached cloudfront and a user with write access. This is typically what you want if you need quick hosting for static files for you website. This is made in contrast to the terraform guide, which does the same, but using different tools If…

Continue Reading

Add S3 bucket using Terraform (example)

Edit: I was going to make the s3 bucket with cloudfront, but Terraform has no native support for it, though it looks like it’s coming soon. I’ll probably make a followup later. Edit 2: I made a followup on how to do it with Cloudfront A concrete, developer friendly guide on how to create a proper s3 bucket with…

Continue Reading