What is CloudFront?
CloudFront is a CDN (Content Delivery Network) service which provides quick and faster delivery of web content. A Content Delivery Network helps the web page to load quickly in end user’s (visitors) browser and also it helps to improve the Google SERPs. In a web page, the static contents (Images, videos and games) require more time to deliver from the web server. CloudFront distributes the static contents to multiple edge locations and delivers it to the end user quickly and helps to reduce latency.
What are You Going to Learn?
- Advantages of CloudFront
- How to Deploy CloudFront
- How to Manage CloudFront Resources
- Most Common Problems
Advantages of CloudFront
- Amazon’s CloudFront has more than 40 edge locations from all over world to improve the content delivery quickly and with minimal errors.
- It is much cheaper than any other CDN providers.
- Since AWS is providing other services like EC2, ELB, CloudWatch and RDS, it is easy to combine the operations and get a much better performance at lower cost for the website.
What are the Prerequisites for Amazon CloudFront?
You must sign up for AWS services. S3 and CloudFront are the important services for the CloudFront deployment.
- If you are going to broadcast videos, make sure the player plugin is available in the same S3 bucket.
How to Setup and Manage Amazon CloudFront?
- Login to AWS management portal
- You have to login to the https://console.aws.amazon.com/console/home to access the aws services.
- Click on Amazon S3 console at https://console.aws.amazon.com/s3/ and create a new bucket.
- Note: You can also use S3 organizer (s3fox) addon for firefox.
- Set the privileges to the files, so that anyone can read it in public.
- Once the upload is complete, you can find your file in http://s3.amazonaws.com/bucketname/filename
- Now you have to create distributions to the files which you want to include it to cloudfront.
- Click on cloudfront tab in the console home.
- Click create distribution and follow the instructions in the window which will help to create/manage the distribution settings.
- Select the option of Web or RTMP (Real Time Messaging Protocol) for live broadcast
- Set the origin settings for the s3 bucket to map it with cloudfront.
- In the Default cache behaviour settings, you can setup the protocol policy, caching settings and view restriction if required.
- In the Distribution settings, you can select the edge location regions as per your customer base; by default the settings will be using all edge locations. It reflects the pricing too. Also you can set up CNAME by pointing the URL with your own domain name.
- Note: Make sure to update the CNAME records with your DNS provider also.
- At the bottom of that page, you can select the Distribution State to be enabled or disabled.
- After selecting the required changes in the page, click Create Distribution and if the distribution state is enabled, then status page in cloudfront will change into deployed and the pages will be live in approximately 5 minutes.
- Finally, you can test your cloudfront URL, by clicking; it will download the file pointing to the s3 bucket. Else you can include the URL into an html page and test it with your website.
Most Common Problems
- Most of the cloudfront issues/errors arise because of the permissions set to the Amazon S3 bucket.
- You can always enable logging ‘on’ to find out the reasons for error message and it will be easier to identify the problems.
Cloudfront is a perfect solution for e-commerce and gaming websites by delivering/downloading images, videos, text and other files faster than the traditional setup. It can reduce the workload of the web server and let the web pages load quickly.