Cloudfront introductions

What is it?

My take

Do I use it currently?

Source: AWS Documentations

When you request an asset via Cloudfront, if the edge location has a copy of that asset, that is what you get 🎉 but if not it will ‘miss’ and go to the S3 ‘origin’.

When you need to get rid of the cache’s e.g. you just updated content, then you need to ‘invalidate’ it (for a charge).

Use case

One might have been S3 replication but a good idea might be to set up a distribution via Cloudfront so that cached versions of that content are found closer to those users.

Creating a ‘distribution’?

  1. Go to https://console.aws.amazon.com/cloudfront/
  2. Click on Create Distribution
  3. For now, everything can default except the Origin. In this example, I’m using my sandbox S3 bucket

5. Scroll down and press the Create Distribution button

The distribution will start deploying and it can take a while sometimes to propagate. Once it's done you’ll see something

Then you can pull assets from the bucket now using the Origin url https://d1zq4ei7l1j6ct.cloudfront.net. Accessing bucket objects for this will be going to the closes Edge Location for it rather than back to the origin.

Testing it?

Looking ahead

  • EC2’s
  • Load Balancers
  • Auth (IAM’s)
  • DNS (Route53)
  • Databases (RDS, DynamoDB)
  • VPC’s
  • SNS / SQS / API Gateways
  • + more

I’d like to finish getting through this before 2021 ideally, so I can take the associate exam. That being said, I’ve also got some other things I’m learning in more depth alongside this with a little cross over (Serverless Architecture using AWS Lambdas and a React frontend). I might write some stories about that as I go as well.

Fullish-stack engineer (codebykev.dev) and Lead front-end engineer @Pushdoctor with 15+ years developing web apps, installations, AR toys and other fun stuff.