Amazon CloudFront is used to improve the performance of your website. CloudFront makes your website's files (such as HTML, images, and video) available from data centers around the world (called edge locations). When a visitor requests a file from your website, the request is automatically redirected to a copy of the file at the nearest edge location, which results in faster download times than if the visitor had requested the content from a data center farther away.
This Guide shows you how to setup cloudfront to help you website performance .
Cloudfront distribution - We need to create cloudfront distribution first to make our website available from data centers around the world.
Today we will create cloudfront for our website which is hosted in an ec2 instance behind aws elb.
- Open the CloudFront console at https://console.aws.amazon.com/cloudfront/
- Click on Create Distribution.
- Select a delivery method for your content.
- for Web, choose Get Started.
Origin Setting
Origin Domain Name - click on box and select your elbOrigin Path - leave this blank
Origin ID - It will automatically assigned.
Origin SSL Protocols - Select as per your need ( preferred select all).
Origin Protocol Policy - Select in which mode you want to serve you visitors or select match viewer.
HTTP Port - 80
HTTPS Port - 443
Origin Custom Headers - leave this blank.
Default Cache Behavior Settings -
Viewer Protocol Policy - Select as per your requirement.
Allowed HTTP Methods - as per your requirement.
Cached HTTP Methods - as per your requirement.
Forward Headers - as per your requirement.
Object Caching - if you are not sending cache behavior with your header or your web server then select Customize.
now put ttl value as per your caching requirement eg. for how much time you want to cache your object.
all other option leave default .
Distribution Settings
Price Class - Use as from where website visitor access you website if you have a worldwide visitor base you need to use all edge locations.
Alternate Domain Names - put your domain name from which you want to access your website eg. www.adityabaghel.com.
SSL Certificate - if you want to access your website with https so you need to upload ssl certificate in IAM for cloudfront ( Optional)
Default Root Object - Set to index.php or index.html . This page is the default page that the CloudFront distribution returns if the URL used to access the distribution doesn't contain a file name
Logging - if you want log of cloudfront then use this or leave this off.
Distribution State - Enabled
Click Create Distribution.
It can take up to 15 minutes to deploy the distribution. To view the current status of the distribution, find it in the console and check the Status column. A status of
InProgress
indicates that the distribution is not yet fully deployed.When your distribution is deployed, you are ready to reference your content with your new CloudFront domain name. Make a note of the value of Domain Name in the CloudFront console. You'll need this value in the next step. In this example, the value is
dj4p1rv6mvubz.cloudfront.net. Now that you have successfully created a CloudFront distribution, the next step is to update the CNAME record to point your domain www.adityabaghel.com( then value we use in cloudfront while creating ) to - dj4p1rv6mvubz.cloudfront.net.
Cheers now you have working cloudfront distribution which help you to increase you website performance.
please connect me if you need more detailed help in setup your first at bagheladitya[at]yahoo[dot]com.

Comments