Recently I added metrics to my site that show page load times and world locations. After a couple weeks of data it was clear that my site only loaded well for North America and Europe. A significant amount of traffic to my site comes from Asia and South America. After researching some ways to improve the page load times for those parts of the world I settled on using AWS Cloudfront CDN. My site is built on Drupal 7 and there is a nice CDN module available. Before I enabled Cloudfront I checked how much Cloudfront would cost me
-
How to use the Drupal 7 CDN module with AWS Cloudfront
- First you need an AWS account and a Drupal 7 site.
- Sign in to AWS Management console
- Select Cloudfront
- On the Cloudfront management page select Create Dristribution
- Select Download as the distribution delivery method and click continue
- The Origin Domain Name is your sites full DNS i.e. www.chrislarson.me
- The other fields are fine with their default values
- Click Create Distribution. Then wait for half an hour, at least that's how long it felt like to me.
- Once the distribution is created copy the full Domain Name for the distribution i.e. dsfjsdkfjslklasdjfrandomness.cloudfront.net (This will be used in the CDN config on the Drupal site.)
- Install and enable the CDN module on your Drupal site
- Then go to /admin/config/development/cdn and Click the Details tab
- On the CDN config Details page paste the Domain Name into the CDN Mapping box and include the http://, so it looks like http://dsfjsdkfjslklasdjfrandomness.cloudfront.net
- Save the Details and go to the CDN General tab to enable CDN for your site.