Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .php, and image files, to your users. You can store your content in an Amazon S3 bucket and use CloudFront to distribute the content. If you store your objects in an Amazon S3 bucket, you can either have your users get your objects directly from S3, or you can configure CloudFront to get your objects from S3 and distribute them to your users. Using CloudFront can be more cost effective if your users access your objects frequently because, at higher usage, the price for CloudFront data transfer is lower than the price for Amazon S3 data transfer. In addition, downloads are faster with CloudFront than with Amazon S3 alone because your objects are stored closer to your users.
This lab Will cover following steps which is as bellow,
- Creating Amazon CLoudFront Distribution.
- Used your Amazon CloudFront distribution to serve an image file.
- Delete your Amazon CloudFront distribution when it is no longer requirement.
Step 1: Login using appropriate credential for AWS
First of all you have to login in AWS to access the services,
Step 2: Creating Amazon S3 bucket
Here I will provide a link how to create S3 bucket and also how to upload and move document form one bucket to other bucket, Link for this is just click on S3 bucket,
Only one thing is new to give a permission, after creating a bucket and also upload a file in to the bucket just click on the file or a document and then click on the properties, in a given picture you can see the permission tab just create a new one by click on add more permission and then just give a permission to everyone to access this file.
Step 2: Creating Amazon CloudFront Web Distribution
By using this CloudFront service, user can access a same content from the S3 bucket which user get from S3 just way will be change and also it is beneficial for the company base on price. To create a CloudFront just go to the services and then click on the CloudFront which is in Network and Content Delivery part.
After that click on CloudFront we are in main page of this service, In here we can see a list of CloudFront but now we do not have any so just click on Create Distribution,
In the next step we select a delivery method for the content, there are two options first is for WEB which one use a HTTP and HTTPS protocols to transfer data. Second one is RTMP which one use a Adobe Flash Media Server’s RTMP protocol to transfer data. In here we are using WEB one.
After selection of the delivery option of the content in the next step select from where we want to fetch data as example Load Balancer and S3 bucket. We select Bucket in here because we upload our content in S3 bucket. We can go with the default options for other fields which is given in this page.
Step 2: Use Amazon CloudFront to Fetch Content from S3 bucket
In here we are going to call one image file from the S3 bucket and for that we create one HTML file and in this HTML file we use a domain name of that CloudFront Distribution and also use a name of the object which we want to call from here.
After that just run that html file in browser and you can see that file over there using CloudFront Instance which is called from S3 bucket,
In this lab we learn how to create CloudFront and hot to connect to the S3 bucket, we use this technology just because cost reduction as compere to S3 bucket.
In Amazon S3 they provide 5GB free storage with 20,000 get request and 2,000 put request and 15GB of data transfer for each month for one year and the charges will be base on region as per example for Sydney for first 50 TB/month they charge $0.025 per GB in standard Storage.
Where in CloudFront user get 50Gb data transfer and 2,000,000 HTTP and HTTPS request for each month for one year. They will charge as per region data transfer like for 10 TB/ month for Australia $0.140 and for Canada it is $0.085.
They will also charge if we want to transfer data to out of origin and also base on how much time we use HTTP request.