What is the purpose of building an AWS CloudFront CDN? First off what is a CDN?CDN stands for Content delivery network. A (CDN) – is a system of distributed servers (network) that deliver pages and other Web content to a user, based on the geographic locations of the user, the origin of the web page and the content delivery server. Amazon CloudFront is a global content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to your viewers with low latency and high transfer speeds. People will abandon a website that takes longer than three seconds to load. We live in a world where three seconds is too long!
The goal of any business is to have lightning fast content delivered to your customers. The great thing is if your edge location already has the content your users will see it immediately and I mean immediately.
To get started read and create a free AWS account.
AWS CloudFront-is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .php, and image files, to your users. CloudFront delivers your content through a worldwide network of data centers called edge locations.
AWS currently has over 82 edge locations globally across 23 countries.
Login into your AWS Console > Services > S3 > +Create bucket.
I’m located in SoCal so I picked a location on the other side of the world. The new bucket I’m creating is called mysasebocloudfrontlist and the region is Asia Pacific(Tokyo).
I’m keeping all of the default properties for this bucket.
Right now we aren’t changing any permissions.
Once you’ve created your bucket go into your bucket and upload an image file.
After you upload your image change the Manage public permissions to :
Grant public read access to this object(s)
Click next and keep all the default settings for properties.
Refresh your page and your image should now be in your bucket.
If you click on your image link you should be able to view.
Go back to your bucket. We are going to use mysasebocloudfrontlist as our S3 bucket as our origin CloudFront Distribution.
Go to Services > CloudFront
Click on Create Distribution to get started
There are two different options to select as your delivery method. Web or RTMP. The most common is Web. Today we will be using Web. For your domain name if you click in the text box it will auto populate your buckets. I only have one bucket called mysasebocloudfrontlist.s3.amazonaws.cloud
We want the url to use the CloudFront and not the S3 url. Change the Restricted Bucket Access and Grant Read Permissions on Bucket to Yes.
Change the Viewer Protocol Policy to Redirect HTTP to HTTPS
Keep the rest of the default settings and Create Distribution
You’ll see a private content message because we changed our restricted our url access.
Click on the menu on the left side on Distributions. Your status should be Deployed and state is enabled.
Click on your CloudFront distribution under the general tab to find your CloudFront domain name.
If you paste in the url you will get an Access denied message. This message is telling us that users don’t have permission to view this file.
We need to go back to our AWS console to Services > S3 > mysasebocloudfrontlist bucket to view our original image link.
If you replace the s3-ap-northeast-1.amazonaws.com/OfficalMSCLogo.png with your distribution CloudFront name you now can force users to your CloudFront CDN to view your file(s).
Congratulations you have built your first CloudFront CDN!
*Make sure you go back and disable and delete your CloudFront you built.
AWS Console > Services > CloudFront
Once your CloudFront state is disabled you can go in and delete. It can take 15-30 minutes for your CloudFront to go into disabled status. DO NOT forget to go back and delete it or you will be charged.