|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
This section describes how to create a CloudFront download distribution. For more information about download distributions, see Working with Download Distributions.
The following task list summarizes the process for creating a download distribution.
To Create a Download Distribution
Create one or more Amazon S3 buckets or configure HTTP servers as your origin servers. An origin is the location where you store the original version of your web content. When CloudFront gets a request for your files, it goes to the origin to get the files that it distributes at edge locations. You can use any combination of up to 10 Amazon S3 buckets and HTTP servers as your origin servers.
If you're using Amazon S3, note that the name of your bucket must be all lowercase and cannot contain spaces.
If you're using an Amazon EC2 server or another custom origin, review Requirements and Recommendations for Using Amazon EC2 and Other Custom Origins.
Upload your content to your origin servers. If you don't want to restrict access to your content using CloudFront signed URLs, make the objects publicly readable.
You are responsible for ensuring the security of your origin server. You must ensure that CloudFront has permission to access the server and that the security settings are appropriate to safeguard your content.
Create your CloudFront download distribution:
For more information about creating a download distribution using the CloudFront console, see Creating a Download Distribution Using the CloudFront Console.
For information about creating a download distribution using the CloudFront API, go to POST Distribution in the Amazon CloudFront API Reference.
Optional: If you created your distribution using the CloudFront console, create more cache behaviors or origins for your distribution. For more information, see To List, View, and Update CloudFront Distributions Using the CloudFront Console.
Test your download distribution. For more information, see Testing Your Download Distribution.
Develop your website or application to access your content using the domain name that CloudFront returned
after you created your distribution in Step 3. For example, if CloudFront returns d111111abcdef8.cloudfront.net as the
domain name for your distribution, the URL for the file
image.jpg in an Amazon S3 bucket or in
the root directory on an HTTP server will be
If you specified one or more alternate domain names (CNAMEs) when you created your distribution,
you can use your own domain name. In that case, the URL for
image.jpg might be
Note the following:
If you want to use signed URLs to restrict access to your content, see Serving Private Content through CloudFront.
If you want to serve compressed content, see Serving Compressed Files.
For information about CloudFront request and response behavior for Amazon S3 and custom origins, see Request and Response Behavior, and Supported HTTP Status Codes.
The following procedure explains how to create a download distribution using the CloudFront console. If you want to create a download distribution using the CloudFront API, go to POST Distribution in the Amazon CloudFront API Reference.
By default, you can create a combined total of 100 download and streaming distributions for each AWS account. To request a higher limit, go to http://aws.amazon.com/cloudfront-request/.
To create a CloudFront download distribution using the CloudFront console
Sign in to the AWS Management Console and open the Amazon CloudFront console at https://console.aws.amazon.com/cloudfront/.
Click Create Distribution.
On the first page of the Create Distribution Wizard, accept the default selection, Download, and click Continue.
Specify settings for the distribution. For more information, see Values that You Specify When You Create or Update a Download Distribution.
Origin settings when the origin is an Amazon S3 bucket
Origin settings when the origin is an HTTP server
Default cache behavior settings
Click Create Distribution.
After CloudFront creates your distribution, the value of the Status column for your distribution will change from InProgress to Deployed. If you chose to enable the distribution, it will then be ready to process requests. This should take less than 15 minutes.
The domain name that CloudFront assigns to your distribution appears in the list of distributions. (It also appears on the General tab for a selected distribution.)
When your distribution is deployed, confirm that you can access your content using your new CloudFront URL or CNAME. For more information, see Testing Your Download Distribution.
After you've created your distribution, CloudFront knows where your origin server is, and you know the domain name associated with the distribution. You can create links to your objects using the CloudFront domain name, and CloudFront will serve the objects to your web page or application.
You must wait until the status of the distribution changes to Deployed before you can test your links.
To create links to objects in a download distribution
Copy the following HTML code into a new file, replace
domain-name with your
distribution's domain name, and replace
object-name with the name of your object.
<html> <head>My CloudFront Test</head> <body> <p>My text content goes here.</p> <p><img src="http://
object-name" alt="my test image" </body> </html>
For example, if your domain name were
d111111abcdef8.cloudfront.net and your object were
image.jpg, the URL for the link would be:
If your object is in a folder on your origin server, then the folder must also be included in the URL. For example, if image.jpg were located in the images folder on your origin server, then the URL would be:
Save the HTML code in a file that has a .html filename extension.
Open your web page in a browser to ensure that you can see your object.
The browser returns your page with the embedded image file, served from the edge location that CloudFront determined was appropriate to serve the object.