Amazon CloudFront
Developer Guide (API Version 2013-05-12)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

CloudFront Concepts

This section explains the basic concepts behind CloudFront.

Objects

Objects are the files you want CloudFront to deliver. Objects typically include web pages, images, and media files, but can be anything that can be served over HTTP or one of the versions of Adobe RTMP, the protocol used by Adobe Flash Media Server.

Origin Server

An origin server is the location where you store the original, definitive version of your objects. If you're serving content over HTTP, your origin server is either an Amazon S3 bucket or an HTTP server, for example, a web server. Your HTTP server can be running on an Amazon Elastic Compute Cloud instance or on a server that you manage; these servers are also known as custom origins.

If you're serving media files using RTMP, your origin server is always an Amazon S3 bucket.

Distributions

After you store your objects in your origin server, you create a distribution, which tells CloudFront where your objects are. When you create a distribution, CloudFront gives you a unique domain name that you use to reference your objects, for example, d111111abcdef8.cloudfront.net.

Suppose your origin is an Amazon S3 bucket called myawsbucket that contains an image called /images/image.jpg. You want to display the image on your web page. If you display the image directly from your Amazon S3 bucket, the URL is:

http://myawsbucket.s3.amazonaws.com/images/image.jpg

If you instead display the image using CloudFront, the URL is:

http://myawsbucket.cloudfront.net/images/image.jpg

If you already have a domain name (for example, example.com) that you want to use for links to your objects, you can specify up to 10 alternate domain names, also known as CNAMEs. If you add the alternate domain name www.example.com, you can use the following URL for links to the image:

http://www.example.com/images/image.jpg

For more information about alternate domain names, see Using Alternate Domain Names (CNAMEs).

You can create two types of distributions:

  • A download distribution delivers content using HTTP or HTTPS. Using a download distribution, you can configure CloudFront to access your web content in any combination of up to 10 Amazon S3 buckets and custom origins.

  • A streaming distribution delivers digital media using Adobe Flash Media Server and the Real-Time Messaging Protocol. The origin for a streaming distribution is always one Amazon S3 bucket.

Edge Locations

An edge location is a geographical site where CloudFront caches copies of your objects. When an end user requests one of your objects, CloudFront decides which edge location is best able to serve the request. If that edge location doesn't have the object, CloudFront gets a copy from the origin server, serves it to the end user, and stores it in the cache at that edge location.

For the locations of CloudFront edge locations, go to the CloudFront Details page.

Expiration

By default, an object expires after being in an edge location for 24 hours. After the object expires, the next time CloudFront gets a request for the object, the request is forwarded to your origin to determine whether an updated version is available. If you have updated the object on your origin server, the origin server returns the updated version. CloudFront serves it to the end user and stores the updated version in the cache at that edge location. The minimum expiration time is 0 seconds; there isn't a maximum expiration time limit. For more information about expiration, see Specifying How Long Objects Stay in a CloudFront Edge Cache (Object Expiration).

Eventual Consistency

When you create, modify, or delete a CloudFront distribution, it takes time for your changes to propagate to the CloudFront database. Information about the distribution is eventually consistent, but an immediate request for information about a distribution information might not show the change. Consistency is usually reached within minutes, but a high system load or network partition might increase this time.