This article describes how to create and use a simple CloudFront Distribution using the AWS console, taking advantage of AWS edge locations.
Create a CloudFront Distribution using an Amazon S3 bucket as the origin of Amazon Web Services (AWS)
1. Upload your content to S3 and grant object permissions
For CloudFront to distribute your content, you need to store it in an S3 bucket. You can either create a new bucket or use an existing one. In this article, we will be creating a new bucket.
In AWS Console, select S3 service, in here click “Create bucket.” On this page, you need to provide some configurations:
Finally, create the bucket.
Open your newly created bucket and upload the content that you want to be distributed by CloudFront. In this guide, we will be uploading an image. Click on “Upload” then add the files that you want to upload and click “next.”
On the next screen, change the Manage public permissions to “Grant public read access to this object(s)” and click upload.
2. Create a CloudFront Distribution
In the console, open CloudFront service and click on “Create distribution.”
On the Select, a delivery method for your content screen, click on “Get Started” under the Web category.
On the Create Distribution page, you need to configure some settings. If you want to know more about each setting, you can click the “i” button for detailed information.
Origin Settings
Default Cache Behavior settings.
Distribution Settings.
Finally, click on “Create Distribution.” You will be redirected to the Distribution screen, and you will see your distribution being created with the status of “In Progress.” It will take around 20 minutes to be completed when it does; the status will change to “Deployed.”
<html>
<head>CloudFront Test</head>
<body>
<p>Text Content that you want to share. </p>
<p><img src=https://<domain name>/<object name> alt=”CloudFront test image”/>
</body>
</html>
You can grab the Domain Name from the list of your Distributions deployed (see picture above), and the object name is the name of the file that resides in your S3 bucket (for example ioconnectservices.jpg).
And simply open your HTML file in a browser. You should see something like this.
In this article, we showed how to create a CloudFront Distribution in AWS, which is very useful when you want to deliver your content in an easy and fast way with low latency by caching your content in different Amazon Edge Locations around the globe.