| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Amazon CloudFront is a content delivery service from Amazon Web Services that helps you improve the performance, reliability, and availability of your websites and applications. The content you deliver with Amazon CloudFront will be stored on an origin server. Amazon CloudFront works by distributing your web content (such as images, video, and so on) using a network of edge locations around the world. Your content is served from your configured Amazon S3 bucket or custom origin, to the edge location that has the lowest latency to the user who requests it. Amazon CloudFront is a good choice if you have users that are globally distributed, expect high volume traffic, or even expect at least one hit per day. In this example, the origin is the Amazon S3 bucket where you store static content. Let's create a CloudFront distribution.
Note
This step is optional. You can skip this step and still deploy your web application at the end of this tutorial.
To create a distribution with an Amazon S3 origin, we will use the AWS Management Console.
To create an Amazon CloudFront distribution
Open the Amazon CloudFront console at https://console.aws.amazon.com/cloudfront/.
Make sure that US East (N. Virginia) is selected in the region selector of the navigation bar.
In the CloudFront console click Create Distribution.

On the first page of the Create Distribution wizard, accept the default selection, Download, and click Continue.

On the Create Distribution page under Origin Settings, select the Amazon S3 bucket that you created earlier.

For the value of Origin ID, accept the default value.
Under Default Cache Behavior Settomgs, accept the default values, and CloudFront will:
Forward all requests that use the CloudFront URL for your distribution (for
example, http://d111111abcdef8.cloudfront.net/index.html)
to the Amazon S3 bucket that you specified in Step 4.
Allow end users to use either HTTP or HTTPS to access your objects.
Cache your objects at CloudFront edge locations for 24 hours.
Exclude query string parameters, if any, when forwarding requests for objects to your origin.
For more information about cache behavior options, go to Cache Behaviors in the Amazon CloudFront Developer Guide.

Under Distribution Details, specify the following details:
If your distribution will use a CNAME, for CNAMEs, enter the CNAME alias you want to associate with this distribution. You must own the domain name and have created the CNAME record with your registrar. For this example, leave CNAMEs blank.
If you want to use a default root object with your distribution, for Default Root
Object enter the default root object to associate with
the distribution. For example, index.html. For this
example, leave this field blank.
If you want to enable logging, for Logging select
On, and then from Bucket for Logs, select the Amazon S3 bucket to which you want to
save your logs.For this example,
we select webapplication.s3.amazonaws.com, however you should select the bucket that you created. Type the log file
prefix in the Log Prefix field. For this example,
we type webapp-logging/.
In Comments, you can enter any comments you want to include about the distribution. We will leave this blank for this example.
For the Distribution Status, select Enabled if you want the distribution to accept end-user requests for content as soon as it is deployed. Otherwise, if you prefer to enable the distribution later, choose Disabled. For this example, select Enabled.

If you are satisfied with the distribution settings, click Create Distribution.
After creating the distribution, it might take a few minutes to deploy. The distribution's current status is displayed in the console under Status. InProgress indicates that the distribution is not yet fully deployed.

Note
Even if the distribution's status is Deployed, you still must enable the distribution for use before end users can retrieve content.
When your distribution is deployed, you are ready to reference your content with your new Amazon CloudFront domain name or CNAME.
For more information about Amazon CloudFront, see Amazon CloudFront Documentation. Since the deployment step can take a few minutes to complete, we'll move on to the next step and check our progress later on.
Here's where you are at in building out your architecture.

While we are waiting for the Amazon CloudFront distribution to be deployed, you are ready to start thinking about launching your Amazon EC2 instances. Even though for the purposes of this tutorial, you only have one Amazon EC2 instance up and running, you'll want to have multiple Amazon EC2 instances running across multiple Availability Zones eventually. This way if one Availability Zone goes down, the traffic will be rerouted to another Availability Zone. To prepare for the eventuality of maintaining multiple Amazon EC2 instances, we'll go ahead and create our Elastic Load Balancer resource. In the AWS CloudFormation step, we can scale out to make use of our Elastic Load Balancer. Let's move on to the next step to create our Elastic Load Balancer.