Deliver Content Faster with Amazon CloudFront
Introduction
Implementation
Prepare your content
In this step, we will upload sample static content to an Amazon S3 bucket. In later steps, we will use this bucket as a CloudFront origin. Amazon S3 is a good choice for an Amazon CloudFront origin that includes static content such as images, videos, HTML pages, .css files, and .js files.
2. Enter the Amazon S3 console
When you click here, the AWS Management Console will open in a new browser window. Type S3 in the search bar and select S3 to open the console.

3. Create S3 bucket
In the S3 dashboard, choose Create bucket.
If this is the first time you have created a bucket, you will see a screen that looks like the image pictured here.
If you have already created S3 buckets, your S3 dashboard will list all the buckets you have created.

4. Enter bucket name
Enter a unique bucket name. Bucket names must be unique across all existing bucket names in Amazon S3. There are a number of other restrictions on S3 bucket names as well. Then select a Region to create your bucket in.

5. Set permission settings
You have the ability to set permission settings for your S3 bucket. By default, S3 objects are set to private. You will need to make your image publicly readable. Select ACLs enabled under Object Ownership, deselect “Block all public access” and select the checkbox “I acknowledge that the current settings might result in this bucket and the objects within becoming public.”

6. Create the bucket
You have many useful options for your S3 bucket including Versioning, Server Access Logging, Tags, Object-level Logging and Default Encryption. We won't enable these features for this tutorial.
Select Create bucket.

8. Select Upload
You are in your bucket’s home page.
Select Upload.

9. Upload sample content
Upload the cloudfront-test-image.png file by selecting Add files and selecting the file or dragging the cloudfront-test-image.png file to the upload box.
Open the Permissions dropdown. Select Choose from predefined ACLs and then select Grant public-read access. Select the checkbox “I understand the risk of granting public-read access to the specified objects.”
Select Upload.

Enter the CloudFront console
1. Open the CloudFront console
When you click here, the AWS Management Console will open in a new browser tab. Type CloudFront in the search bar and select CloudFront to open the console.

2. Create a CloudFront distribution
Select Create a CloudFront distribution.

Configure a web distribution
1. Configure settings
You will now configure your settings.
In, Origin domain select the name of the S3 bucket you stored cloudfront-test-image.png in.
You can leave the rest of the configuration settings with the default values for this tutorial. If you would like to learn more about each configuration setting, please read below.
Learn More About Configuration Settings
Default cache behavior settings:
Distribution settings:
Price class: CloudFront has three Price Classes determined by the number of edge locations you want supported throughout the globe. By default, CloudFront uses all edge locations to ensure the best performance. For more information, see Amazon CloudFront Pricing.
AWS WAF web ACL: If you want to allow or block HTTP and HTTPS requests based on criteria you specify, choose the web ACL to associate with this distribution. For more information, see the AWS WAF, AWS Firewall Manager, and AWS Shield Advanced Developer Guide.
Alternate domain name (CNAME): CloudFront will automatically assign you a domain name when you create a web distribution (for example, http://abcdefghi888.cloudfront.net/filename.jpg). You can also specify your own domain name in the URLs for your objects (such as http://yourDomain.com/filename.jpg) once you update your DNS configuration to route DNS queries to your CloudFront distribution. For this tutorial, leave this field blank.
Custom SSL certificate: CloudFront provides a default certificate or you can specify custom SSL certificate.
Default root object: This is where you specify the object that you want CloudFront to request from your origin when a user requests just the root URL of your distribution. For example, a user requests http://www.example.com/, and you can specify that http://www.example.com/product-description.html is delivered. Specifying a default root object avoids exposing the contents of your distribution.
Standard logging: CloudFront can log information about each request for an object and store the log files in an Amazon S3 bucket. There is no extra charge to enable logging, but you accrue Amazon S3 charges for storing and accessing files.
Bucket for logs: If you specified an Amazon S3 bucket to store access logs in, CloudFront can record information about each user request for an object and store the files in the specified Amazon S3 bucket. You can enable or disable logging at any time. For more information about CloudFront access logs, see Access Logs.
Log prefix: If you chose On for Logging, you can specify the string that you want CloudFront to prefix to the access log filenames for this distribution. For more information about CloudFront access logs, see Access Logs.
Cookie logging: When using Amazon S3 as the origin for your objects, Amazon S3 doesn't process cookies, so unless your distribution also includes an Amazon EC2 or other custom origin, you need to select Off for the value of Cookie Logging. For more information about cookies, see Caching content based on cookies.
Description: You can enter any comments that you want to save with the distribution.
