Deploy a Static WordPress using AWS & Cloudflare, Part 3: Connecting Your S3 Bucket to Cloudflare

In order to make the static files of an S3 bucket available to the public on a custom domain, we need to configure DNS settings on Cloudflare. Cloudflare is a DNS service that allows you to connect your domain name from your registrar to wherever you’re hosting your website. Here, we’ll describe how to do this with S3.

This is Part 3 in a series about creating a static WordPress site deployed using AWS S3 and Cloudflare:

Part 1 – Building a WordPress in Docker

Part 2 – Converting a WordPress to a Static Site and Deploying to AWS S3

Part 3 – Connecting Your S3 Bucket to Cloudflare


  1. Register for a Cloudflare account. Then click + Add Site from the main screen and type in your domain name, in this case: gillianlemke.com. Depending on what DNS records are already set up for your domain, there may already be some rows populated here.
  2. You’ll need to log in to your AWS account to get the static endpoint where you want to forward your traffic.

    Under Properties in your S3 bucket, go to Static website hosting and copy your endpoint. It should be in the following format: <bucket-name>.s3-website-<AWS-region>.amazonaws.com.

  3. Back in Cloudflare, create a new record with the following content:
    • Type: CNAME
    • Name: [your domain name], example: gillianlemke.com
    • IPv4 address: this is the endpoint you got from AWS
    • Automatic TTL should be selected
  4. You will then see your Cloudflare Nameservers. These will need to be changed on your domain registrar, e.g. GoDaddy, NameCheap, etc.

Some things to note:

  • Caching: Cloudflare does some great optimization with caching for normal use, but if you don’t notice changes during development, this is probably why. You can clear the cache manually if you just have one update, but there is also a development mode that you can turn on by going to Caching > Development Mode. Just don’t forget to turn it off later!
  • Analytics: Viewing total requests and unique visitors to your site may be helpful. Cloudflare provides this capability right out of the box, along with tracking threats to your site and performance.

It may take up to several hours for your name servers to change over, but once they have, you should be able to view your site live! You’ve successfully set up a static WordPress site deployed with a custom domain on AWS S3 and Cloudflare.