Thursday, June 03, 2021

Define Cloudflare DNS for a AWS S3 bucket

 It's quite a straightforward procedure if you know what to do.

1. Bucket name should exactly match your subdomain name, e.g. mycdn.mysite.com

2. Subdomains should be in one level. Buckets named like part1.mycdn.mysite.com won't work via DNS

3. Define a bucket policy granting Cloudflare servers access. See the JSON here, replace 'www.example.com' with your bucket name (mycdn.mysite.com)

4. Login to Cloudflare and in DNS section add a CNAME record:

mycdn.mysite.com => mycdn.mysite.com.s3.amazonaws.com


That's it!



No comments: