Enable Amazon Cloudfront CDN in WordPress

I was setting up a wordpress web site to use Amazon S3 + Cloudfront as CDN. I used w3 total cache plugin for this. w3 total cache plugin have option to auto create Amazon S3 bucket and cloudfront distribution, for for this, you need to give Amazon AWS API keys.

WordPress CDN Setup W3 Total Cache

Clicking the button “Create as new bucket with distribution” will auto create s3 bucket and cloudfront for you.

if you site have images already uploaded, you need to upload them to Amazon S3. This can be done with W3 Total Cache.

Upload WordPress media to CDN

If you have lot of files, upload may fail. You may need to use Amazon AWS CLI tool to do the upload.

If needed, you can upload themes and plugins folder too