Creating a CloudFront distribution

We start by opening our AWS management console and navigating to the CloudFront section. Once there, we click on the Create Distribution button to begin the process:

  1. In Step 1, we will be able to select either a Web or RTMP distribution. In our example of caching the static website, we will select the Web distribution, but an RTMP one can be selected when delivering content using the Adobe Flash Media RTMP protocol. Click on the Get Started button below the Web distribution:

  1. In Step 2, we will configure our Origin. For domain name, we need to specify our S3 bucket that is serving the static website. Instructions on how to set up the S3 static website can be found in Chapter 7, Understanding Simple Storage Service and Glacier, under the Working with S3 section.
  2. In the Default Cache Behavior section, we will select the Viewer Protocol Policy as HTTP and HTTPS and Allowed HTTP Methods as GET, HEAD. If you would like to read up on the HTTP methods themselves, please read the HTTP method definitions in the Further reading section of this chapter. We will not be modifying the headers, so under Object Caching we need to leave Use Origin Cache Headers selected:

  1. Once the distribution is created, you can see it in the CloudFront management console. The status will initially be In-Progress and should turn to Enabled as soon as all the distribution propagates across the CDN. Please record the Domain name as this will be the DNS name that we will be using to test the performance of the newly created distribution:

  1. To test whether the performance of the static website has actually improved now that we have enabled the CloudFront distribution, we can browse to the CDN Performance Checker Tool at https://www.cdnplanet.com/tools/cdnperfcheck/.
  1. We will initially enter our origin DNS name directly to get a baseline to which we can compare our CDN:

  1. Once we have the metrics from our origin, let's enter the CloudFront distribution DNS name and test the performance of the website using the CDN. Make sure you run the performance checker at least twice as the CDN might not be populated on the first try and the content will be delivered from the origin instead. We should see the correct result on the second or subsequent tries:

  1. Comparing the metrics, we can see that the performance of the website has improved dramatically. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset