Creating a CloudFront Distribution

Lab Steps

lock
Logging In to the Amazon Web Services Console
lock
Creating an Amazon S3 Bucket
lock
Creating a CloudFront Distribution
lock
Uploading a Demo Image Gallery to the S3 Bucket
lock
Making the Amazon S3 Objects Publicly Accessible
lock
Testing the CloudFront Distribution
lock
Disabling a CloudFront Distribution
lock
Deleting a CloudFront Distribution
lock
Destroying an S3 Bucket
Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

 Introduction

Amazon CloudFront is a content delivery service (CDN). In Amazon CloudFront, the content is organized into distributions.

Each distribution has a unique cloudfront.net domain name (e.g. cdn123.cloudfront.net) that can be used to reference objects through the global network of edge locations. 

To use Amazon CloudFront:

  • Store the original versions of your files on one or more origin servers. An origin server is the location of the definitive version of an object. Origin servers could be an Amazon S3 bucket, an Amazon EC2 instance, an Elastic Load Balancer, or another remote server.
  • Create a distribution to register the origin servers with Amazon CloudFront.
  • Use your distribution’s domain name in your web pages, media player, or application. When end users request an object using this domain name, they are automatically routed to the nearest edge location for high-performance delivery of your content.

 

Instructions

1. In the AWS Management Console search bar, enter CloudFront, and click the CloudFront result under Services:

alt

 

2. To start creating a CloudFront distribution, click Create a CloudFront distribution:

alt

The distribution creation form will load that contains four main sections:

  • Origin
  • Default cache behavior
  • Function associations
  • Web Application Firewall
  • Settings

 

3. Under Origin, in the Origin domain drop-down, select the S3 bucket you created in the previous lab step:

alt

Warning: If you don't see the S3 bucket in the origins list, manually enter the following: <name_of_the_bucket>.s3.amazonaws.com

 

4. Under Origin, in the Origin access, select Origin access control settings and click Create control setting:

alt

Under Create control setting, enter the following values:

  • Name: Enter name beginning with 
  • Signing behavior: Ensure Sign requests is selected

alt

Origin access control secures S3 origins by allowing access to only designated distributions. This follows AWS best practice of using IAM service principals to authenticate with S3 origins.

 

5. Click Create

Leave all other fields in this section as well as the Default cache behavior section as their default values.

 

6. Under Web Application Firewall, select Do not enable security protections:

alt

 

7. Scroll down to Settings, and in the Price class selection, select Use only North America and Europe:

Amazon CloudFront minimizes end-user latency by delivering content from its entire global network of edge locations. Price Classes let you reduce your delivery prices by excluding Amazon CloudFront’s more expensive edge locations from your Amazon CloudFront distribution. In these cases, Amazon CloudFront will deliver your content from edge locations within the locations in the price class you selected and charge you the data transfer and request pricing from the actual location where the content was delivered.

The time required for deploying a new CloudFront distribution also depends on the number of selected Edge Locations. Selecting all edge locations will take longer to deploy.

 

8. In the Default root object field, enter /gallery/index.html.

CloudFront will serve the default root object when the base distribution URL is requested.

 

9. To finish configuring your distribution, at the bottom of the page, click Create distribution:

alt

You will be brought to the distribution details page.

CloudFront automatically assigns an ID (top of the page) and a Distribution domain name to the distribution and starts updating the edge locations to serve your content:

alt

 

10. Return to the Distributions table by clicking the breadcrumb link at the top of the page:

alt

Within the table, observe the Status field of your distribution. It will read Enabled while the Last modified field will display Deploying

You do not need to wait for the distribution to finish deploying completely, and you may proceed to the next lab step now.

 

Summary

In this lab step, you configured and created a CloudFront distribution.

Validation checks
1Checks
Created CloudFront Distribution that Points to Static Website

A CloudFront distribution returns a status code of 200 when visited

Amazon CloudFrontAmazon S3