
Member-only story
CDN Design and Implementation
Today I will implement a CDN design using Go. I’m not familiar with Go, and this is my first time creating a CDN.
So we’ll learn how to implement it together.
Requirements
- Create an endpoint to upload an image to S3.
- Delete an image from S3 with a key.
- Update images from S3 with a key. (After updating, invalidate the cache from CloudFront.)
- Fetch images from CloudFront. (Creating a CloudFront URL is OK.)
- Dockerize the project.
- Document each endpoint.
How to create an S3 Bucket in AWS
To create an S3 bucket in AWS, follow these steps:
- Log into your AWS Management Console and navigate to the S3 service.
- Click on the Create Bucket button.
- Give your bucket a unique name. Note that bucket names must be unique globally across all of AWS.
- Choose the region where you want your bucket to be located.
- Choose the desired settings for your bucket. You can specify whether you want your bucket to be private or public, whether you want to enable versioning, and other options.
- Click the Create Bucket button to create your bucket.
Your S3 bucket should now be created and ready to use. Remember to properly configure access controls to ensure the security of your data.
How to create a CloudFront distribution in AWS
To create a CloudFront distribution in AWS, follow these steps:
- Log in to your AWS Management Console and navigate to the CloudFront service.
- Click on the Create Distribution button.
- Choose whether you want to create a web or RTMP distribution. Web distributions deliver content over HTTP/HTTPS, while RTMP distributions stream media over RTMP.
- Configure your distribution settings. This includes specifying the origin (the location where your content is stored, such as an S3 bucket), setting up caching behavior, and configuring security settings like SSL/TLS certificates.