Home Blog

Amazon S3 and CloudFront as a WordPress CDN


My original go at setting up CloudFront as a CDN did not go very well. At the end of the last post on setting up CloudFront and W3 Total Cache, it was working (via WP Rocket), but when I changed the theme, things went back to not using the CDN. In this post, I will look at setting up Amazon S3 and using CloudFront through that instead. Hopefully, it should be a bit more stable and less likely to break.

CloudFront and W3 Total Cache

AWS CloudFront

After setting up WordPress in AWS and then switching off CloudFlare so I can use certificates from Amazon Certificate Manager, I noticed a pretty big drop in the GTMetrix score, specifically the YSlow report, and this was due to the lack of CDN (Content Delivery Network). Thankfully, I can progress with my studies of all things AWS, and set up CloudFront.

Certificates and Load Balancers: WordPress in AWS


Following the initial WordPress setup, I need to give the site an SSL certificate, Google doesn’t like sites without certificates. I already have a wildcard cert from CloudFlare, however, I want to keep this as much AWS’d as I can, therefore I want to use the Amazon Certificate Services for this sites certificates. However, EC2 on it’s own does not work with the certificates created in AWS. So, we need to go a bit further and set up an elastic load balancer to sit in front of the website, which will allow us to use the certificates.

WordPress in AWS


I decided that my foray into AWS needed a dedicated platform, so here it is (aws.802101.com). My original plan was to do a complete lift and shift of www.802101.com, but that did not turn out well, and me, being impatient, decided to start with something a little easier. So, I started afresh with WordPress in AWS. I am using the same template, and the reason for this will be clearer shortly. But let’s have a little look at how easy it is to set up WordPress in AWS.