Working with the Amazon CloudFront CDN
This is a compilation of things learned while setting up Amazon CloudFront as a CDN for my WordPress site as well as using it as software distribution network.
CNAMEs
Adding a CNAME
A CloudFront distribution can be used with ten different CNAMEs. Adding a CNAME is simple enough if you keep in mind that configuring the CNAME in DNS is not sufficient; each CNAME must be added to the distribution’s properties, too.
Removing a CNAME
Removing a CNAME is equally simple, but there is one caveat: you might have CSS or other objects in the CDN’s cache that still refer to the CNAME. Such objects must be deleted from CloudFront’s cache. See below how to do that.
Deleting an Object from the Cache
If you use CloudFront as a distribution mechanism for downloads like I do, at some point in time you want to update your files – and you want that update reflected in the CDN quickly.
For a long time this was not possible with CloudFront. Amazon suggested lame workarounds involving giving each version a unique name, but then in 2010 they added this essential feature. Unfortunately, it is not available from the AWS Management Console, only via API calls. But there are a tools that make use of the API to provide the purge functionality.
W3 Total Cache
This WordPress plugin comes with support for CDNs and Amazon CloudFront. To purge an object click “CDN” and then “Purge”:
A popup window opens. Enter the relative path without leading slash and click “Purge”.
Bucket Explorer
Bucket Explorer is a commercial tool for managing Amazon S3 and CloudFront. It comes with a fully functional 30-day trial version which I used for my tests.
After starting the tool and entering access key ID and secret key Bucket Explorer lists my S3 buckets. To manage CloudFront, click “Distribution”. In the window that pops up, right-click your distribution and select “Get CloudFront Invalidation List”:
The invalidation list window pops up and displays both past and current invalidations (read: deletes). You can create new invalidations and check if an invalidation is still being processed by the CDN or if it is completed:
Processing Time
Each change to a CloudFront distribution needs to travel through the CDN’s network to all nodes before it is activated. That may take some time; my changes were through in 10-20 minutes.
3 Comments
I always enjoy learning what other people think about Amazon Web Services and how they use them. Check out my very own tool CloudBerry Explorer that helps manage S3 on Windows . It is freeware. It comes with a full support for CloudFront
Hi Helge,
I’m using “CloudBerry Explorer for Amazon S3” – that’s free and excellent
Thanks Helge..
Thanks for specifying Bucket Explorer in your Blog,Unlike other S3 tools Bucket Explorer provides all the Funitionalities free for 30 days.
We have tried to design an interface which is easy as well provide you all the services of Amazon S3,Cloud front,SNS and Import-Export.
New version of Bucket Explorer provides you Multipart Upload and Resume it,Multipart Download as well many other features.
Amazon S3 is really nice service provider world wide and most demanding.
http://www.bucketexplorer.com/