Amazon Cloudfront Dynamic Content Delivery
HTTP GET and HEAD requests are currently supported by Amazon CloudFront. Over time, we will add support for POST requests.
Our sample setup
You can convert your existing blog or setup a new blog from scratch to use cloudfront. For demonstration purpose, I'm going to setup a new blog called www.contentdeliverynetworklog.com and serve the whole blog via cloudfront as follows:
- Blog domain name: www.contentdeliverynetworklog.com (CNAME to cloudfront)
- Blog origin domain name: cp.contentdeliverynetworklog.com. To fetch web content from this origin web server.
- Static asset domain name: s0.contentdeliverynetworklog.net (CNAME to cloudfront).
- Static asset origin domain name: origin.contentdeliverynetworklog.net.
- Custom origin IP address for both static/dynamic assets: 75.126.153.203
- Caching ruleset for your dynamic and static assets: I am going to use a combination of Batcache+Memcached. However, you can use other plugins such as "W3 Total Cache" (not tested).
- DNS server: Route 53 (or use your existing BIND9 based dns servers).
Step #1: DNS setup for cp.contentdeliverynetworklog.com
First, point your custom origin domain cp.contentdeliverynetworklog.com to 75.126.153.203. A typical BIND 9 entry will look as follows in your zone file:
cp 600 IN A 75.126.153.203
Step #2: Create a bucket
You may want CloudFront to log all viewer requests for files in your distribution. This is useful for stats program such as webalizer and awstats. You need to create a bucket by selecting a bucket name and region. This is required to store web server logs. Login to aws console > open the Amazon S3 console at https://console.aws.amazon.com/s3 > Click Create Bucket:
Please note that access logging is an optional feature of CloudFront. There is no extra charge for enabling access logging. However, you accrue the usual Amazon S3 charges for storing and accessing the files on Amazon S3. Please see this guide for more information on log file formats.
Step #3: Configure AWS Cloudfront Dynamic CDN for www.contentdeliverynetworklog.com
Now, let us see how to configure and use CloudFront to distribute dynamic and static content. I am going to create a CloudFront distribution and configure it to fetch web content from my origin web server called cp.contentdeliverynetworklog.com. First, open the Amazon Cloudfron console at https://console.aws.amazon.com/cloudfront > Click Create Distribution > Set a delivery method to Download > Continue.
Origin settings
- Set Origin Domain Name to cp.contentdeliverynetworklog.com
- Set Origin ID to CustomWWW-cp.contentdeliverynetworklog.com
- Set Origin Protocol Policy to HTTP Only (CloudFront will connect to my origin using only HTTP).
Default cache behavior settings
- Set Viewer Protocol Policy to HTTP and HTTPS.
- Set Object Caching to Use Origin Cache Headers. My origin server is adding a Cache-Control header to control how long your objects stay in the CloudFront cache. However, you can specify a minimum time that objects stay in the CloudFront cache regardless of Cache-Control headers by selecting Customize option and setting Minimum TTL in seconds (default is 24 hours).
- Set Forward Query Strings to Yes.
Distribution settings
The distribution settings affect both cdn performance and pricing. You need to select the price class associated with the maximum price that you want to pay for CloudFront service.
- Set Price Class to Use All Edge Locations.
- Set Alternate Domain Names(CNAMEs) to www.contentdeliverynetworklog.com. I want to use my own domain name instead of the CloudFront domain name for the blog URLs. You need need to create a CNAME record with DNS server to route queries for www.contentdeliverynetworklog.com to *.cloudfront.net.
- Set Logging to On.
- Set Bucket for Logs to webserverlog-contentdeliverynetworklog.s3.amazonaws.com (see step #2 create a bucket for more info).
- Set Log Prefix to stats-logs/.
- Finally, set Distribution State to Enabled.
Finally, click on the Create Distribution button. You will see the status as follows:
Please note down the domain name d3qrb8why8gyke.cloudfront.net.
Step #4: DNS CNAME setup for www.contentdeliverynetworklog.com
You need to create a CNAME record with DNS server to route queries for www.contentdeliverynetworklog.com to d3qrb8why8gyke.cloudfront.net. A typical BIND 9 CNAME entry will look as follows in your zone file:
www 600 IN CNAME d3qrb8why8gyke.cloudfront.net
Nice post, I bookmark your blog because I found very good information on your blog, Thanks for sharing more information. Regards aws jobs in hyderabad.
ReplyDeleteHi, I must appreciate you for providing such a valuable content for us. This is one amazing piece of article.
ReplyDeleteBest Regards,
AWS Online Training
AWS Training
Amazon Web Services Online Training in Hyderabad
AWS Online Training in Hyderabad
AWS Certification Online Training
AWS Training Online
AWS Certification Training
AWS Training and Certification
Hey..nice information i read your blog completely it's really good keep it up for more updates AWS Online Course
ReplyDeletevery useful information, the post shared was very nice.
ReplyDeleteAmazon Web Services Online Training
This comment has been removed by the author.
ReplyDeleteI like this very much. It is very useful for my research. It shows your interest in this topic very well. I hope you will post some more information about the software. Please keep sharing!
ReplyDeleteDot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Nice blog post on AWS
ReplyDeleteAWS Training in Chennai | AWS Training Institute in Chennai | Best AWS Training in Chennai | AWS Training Class in Chennai | AWS Training Center in Chennai
Great post I must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more. 4 ps of marketing
ReplyDelete