How Do You Set up AWS CloudFront?

Problem scenario
You want to test out a CDN in AWS.  What do you initially deploy CloudFront?

Solution

Prerequisite

This assumes that you have an S3 bucket with read permissions.  To do this, log into the Amazon S3 console and create a bucket.  Upload files and configure the permissions to grant read permissions to anyone.  

Procedures
AWS CloudFront has "Distributions."  You want to create a CloudFront Distribution.

1.  Log into the CloudFront console with this link.

2.  Click "Create Distribution"

3.  For this example, click "Get Started" under "Web" (as the delivery method for your content).

4.  Fill out the fields.  Not every field is mandatory.  If you are not sure click the "i" icon for more information on what to put in each field.  If you provide a basic S3 bucket of files (and not a website link hosted by an S3 bucket), CloudFront will take 15 minutes to deploy.  A website file (e.g., an AngularJS or HTML file) will make things faster.  But an S3 bucket is acceptable to use.

5.  Click "Create Distribution" in the lower right hand corner.

6.  You will see the "CloudFront Distributions" page with the Status "In Progress."  Eventually the Status will change to "Deployed."  If you configured CloudFront to use a regular S3 bucket by itself (and not a specific web page file), be prepared to wait 15 minutes.

7.  When the status is "Deployed", you can test your links.  Copy the domain name, e.g., d3lnudekzjqklzuwx.cloudfront.net and construct a URL to a file of your choice.  If you uploaded a file named foobar.txt to your S3 bucket (that is now part of the CloudFront CDN), construct the URL as follows:

http://d3lnudekzjqklzuwx.cloudfront.net/foobar.txt

8.  Open a web browser.  Go to the URL described in step #7.

Leave a comment

Your email address will not be published. Required fields are marked *