CloudFront is Amazon’s content delivery network (CDN) service that quickly and securely delivers your content to end users all around the globe. CloudFront is integrated with other AWS services such as Amazon EC2, Amazon S3, Amazon Route 53, etc and uses the Amazon’s highly redundant global network for content distribution.
In this example, I will show you how to create a cloud front distribution for a static website hosted on an S3 bucket. Click here to see the instructions to host static website on an S3 bucket.
Firstly, from the services page, choose CloudFront found under Networking & Content Delivery services. If you have previously used CloudFront, you will also find it under the History pane on the left side.
Choose Create Distribution on the Amazon CloudFront page to create a new distribution.
CloudFront offers 2 types of distributions – Web and RTMP. Web distribution is used for website content and RTMP is used for media streaming. Choose Get Started under the Web delivery method to create a Web distribution.
For the Origin Domain Name, CloudFront is integrated with other AWS services and it will show you a list of Origins to pick from. Choose the S3 bucket end point that you would like to create the distribution for.
Origin ID is automatically populated for the chosen S3 bucket. Select ‘Yes’ for Restrict Bucket Access and create an Origin Access Identity if you don’t already have one. Go through all the other settings and modify accordingly. I chose default options for most of the settings.
Under the Distribution settings, choose Price Class based on the location of your end users and type index.html(your website’s index document) for the Default Root Object and choose Create Distribution. It will take about 15 mins to create the distribution.
After the distribution is created, select the Distribution ID that you just created and in the General tab, you will see Domain Name for the distribution.
Copy the Domain Name into the browser and you will see the contents of your S3 website being delivered through the CloudFront distribution.