CloudFront for WordPress using W3 total cache.

I think you all know that Page loading is an official search engine ranking factor, and if your pages are not loading within 3 seconds, you need to work on it right away. You need to take care of your site loading speed in Desktop, as well as on Mobile devices. Along with taking care of basic requirements such as good hosting company, cache integration & few others, Content Delivery Network (CDN) plays a great role in speeding up your WordPress site. Choosing a good CDN is very tough, we know it. That’s why we always recommend using Cloudfront. It is reliable, fast, and protected by Amazon and we ourself use it. So, let’s jump into setting up your very first CDN.

Prerequisites:

  1. AWS account
  2. WordPress site

Set Up A CloudFront Distribution:

Setting Up IAM:

  • Go to your AWS console Homepage and again click on ‘Services’ and select ‘IAM’under ‘Security, identity & Compliance’
  • Select ‘Groups’ tab on the Left Sidebar.
  • Click on ‘Create New Group’
  • Give your Group a name and click on “Next Step”
  • Now check on ‘AdministratorAccess’ checkbox to grant Admin access to your Group and Click Next Step.
  • And now click on ‘Create Group’

And now your group is set up and it’s time to assign users to that group. To do so:

  • Select ‘Users’ tab on the Left Sidebar
  • And click on “Add user” and give a Username and check the checkbox saying ‘Programmatic access’ under ‘Access type’ to grant it programmatic access.
  • And now click on Next Permission
  • And now assign that user to the group that you have previously setup by clicking on the checkbox.
  • Now click on ‘Next: Review’
  • And now click on ‘Create user’ button
  • Now Download your Access Key ID and Secret access key by clicking on Download .csv button, because you will need these in a few moments.

Setting up CloudFront:

Now you have done your work on AWS. So, let’s setup CloudFront CDN for your Website to do so follow the below steps:

  • Login to your WordPress Dashboard
  • And install W3 total cache
  • After installation, you should be redirected to the W3 total cache plugin page. If not click on performance.
  • And move over to General settings.
  • Scroll down to the Middle of the page for our CDN settings.
  • click on Enable
  • And select ‘Amazon CloudFront’ under “Origin Pull / Mirror”

This is where some of the information that I have seen is making things more difficult Some Tutorials tell that it should be Origin Push. Where you have to actually put all the information out into your S3 bucket to work with CloudFront. Some people are setting it up as Generic Mirror. Do not Bother up with This thing and select ‘Amazon CloudFront’under “Origin Pull / Mirror” to make things simple.

  • After that click on save all settings.
  • Now you should have an Error saying “A configuration issue prevents CDN from working…”
  • So, now go to CDN under the Performance tab
  • and scroll a little bit and you should find the Configuration Box.
  • Now you should enter your AWS Access Key ID and Secret Key that you have previously Downloaded
  • And the last thing, do not forget to enter your CloudFront Url on “Replace site’s hostname with” section.

Replacing site URL with CloudFront:

  • Move over to your AWS console
  • Click on CloudFront under Services.
  • And now you should find your website listed in the Distribution section
  • Wait for some time until the status changed from In Progress to Deployed. Don’t panic this might take some time, it depends on how big your website is it takes about 15 minutes to Deploy a Default WordPress installation.

That’s all for today. If you have faced any problem in setting up CloudFront for your WordPress Website feel free to Comment Below.

Leave a Comment

Your email address will not be published. Required fields are marked *