If you’re using Amazon S3 for offloading your media files and looking forward to a faster distribution system, a content delivery network (CDN) is a suitable solution for you.
Amazon’s CDN is called Amazon CloudFront and it’s a web service to securely deliver your static and dynamic web content with the best possible performance.
CloudFront has data centers called edge locations around the world and when one of your user requests for contents, it serves them with low time delay and high transfer speed.
Today, you’ll learn to create an Amazon CloudFront Distribution and serve web contents through CloudFront.
Laten we beginnen.
Create An Amazon CloudFront Distribution #
Follow these simple steps to create an Amazon CloudFront Distribution:
1. Log in to your Amazon S3 console home page.
On the Services page, under the Networking and Content Delivery section, click on the CloudFront option.

2. This page named Select a delivery method for your content will appear.
Under the Web section, click on the Get Started button to start creating a CloudFront.

3. Click on the Create Distribution button.

You’ll be taken to the Create Distribution page.
Here, you’ll find following options:
- Origin Domain Name.
- Origin Path.
- Origin ID.
- Default Cache Behavior.
- Restrict Viewer Access.

4. On the Origin Domain Name field, select your desired bucket from the list.
5. You can leave the Origin Path and the Default Cache Behavior fields blank.
Also, you can change Restrict Viewer Access later.
6. Now, in the Distribution Settings section, if you want to use a custom domain for delivering the media files, enter it into the Alternate Domain Names (CNAMEs) field.
If not, you can leave the field as it is.
7. Click on Create Distribution button.
Your CloudFront Distribution has created.
Next, you have to connect your CloudFront Distribution with Media Storage to Cloud plugin to start serving your media files.
Connect Your Cloud Front Distribution With Media Storage to Cloud #
First, make sure the Media Storage to Cloud plugin is installed and activated on your site.
Then, follow these steps to connect your CloudFront Distribution with Media Storage to Cloud and start serving media files:
1. Now, you have to connect your Amazon S3 Bucket with Media Storage to Cloud Plugin.
Follow this to connect your Amazon S3 Bucket with Media Storage to Cloud Plugin.
2. Once you’ve successfully connected your Amazon S3 Bucket with Media Storage to Cloud, go to the CloudFront home page and copy the CloudFront Distributions domain name.

3. Now go to Media Storage to Cloud plugin and click on Settings.
Choose the Amazon S3 option and enter your CloudFront domain address into the Content Delivery Network URL field.

**Make sure that you are putting a complete URL in the field with http/ https, for example: https://example.com.
**And to make this work perfectly, don’t forget to make the storage bucket public.
Click on Save, and your CDN URL is now saved.
4. Click on the Sync menu.

Your media files will start syncing with your Amazon S3 bucket.
After syncing the media file, a confirmation message will appear.
You’re now ready to serve the media files of your site from Amazon CloudFront.