How to Create a CloudFront Distribution

Now that you have offloaded WordPress files successfully to your Amazon S3 bucket. Let’s improve their load speed and your website overall performance using CloudFront CDN. In order to achieve this, we need to create an AWS CloudFront Distribution.

First of all, select CloudFront from the list of services in your AWS Console.

Then select Create Distribution.

After that, click on Get Started button in the Web section.

In the next form, you must enter the Origin Domain name. There are two options for it.

  1. Your Amazon S3 Buckets domain name which is auto-suggested when entering the bucket name to the input field.
  2. Your website domain which is hosting your WordPress website.

If you choose option #1, you need to modify Restrict Bucket Access option which helps our new Distribution can have permissions to read the S3 storage data and set Origin Path to be /pda-media. pda-media is a folder where we store the public files.

You can leave the rest with their default values. Finally, click on Create Distribution button to complete the step.

Now is the time for coffee because it will take a while to create a distribution. Once it’s completed you can find your CloudFront distribution from the list and find out its domain name by clicking on it.


(Optional) CNAME configuration

Apparently, the CloudFront Domain Name is quite ugly. You can replace that with your CNAME (eg: by clicking “Edit” on the top right-hand corner of your screen.

In the Alternate Domain Names (CNAMEs) field, please paste your CNAME there.

That’s about it. Now go back and enjoy your coffee 😉

Lasted updated on August 19, 2020