I'm now setting myself to learn about AWS. Has anybody documented their experiences with CloudFront and Craft?

3 Answers 3


I'm running Amazon S3+CloudFront on several of my sites. There's not really much to it, Craft makes it really easy:

  • Create a new Amazon S3 assets source in Craft.
  • Set up CloudFront in AWS (see this link).
  • In the settings for your assets source, add your cloudfront url (something like http://xxxxxxxxx.cloudfront.net/, or your custom CNAME if you set one up) to the "URL Prefix" field.

That should be it!

  • Is this using CloudFront for just the assets, or for the entire site? When I attempt to use CloudFront for the entire site, I end up setting 'siteUrl' => '/' in my config. Does that seem right? Commented May 21, 2015 at 17:38
  • Some times I only use CF for external assets like js libraries etc. Then I just set a new config item called 'cndUrl' => "" and set that before anything in my templates like {{ cdnUrl }}. Commented Oct 16, 2015 at 6:33
  • Andre has it exactly right -- we run a large production Craft Pro site through CloudFront for all assets, and use the settings just as he describes. You then actually have two layers of caching going on, since CF is just a large edge-cache, and Craft lets you set the cache length within the S3/CF Asset settings. So just be aware of the TTL for both of those levels.
    – Neal Magee
    Commented Dec 29, 2015 at 15:43
  • It's probably worth noting that this pertains to Asset sources only, and not whole-site caching with CloudFront.
    – Matt Stein
    Commented Jul 12, 2016 at 19:51

I wrote up an article that might be helpful for future-people looking for step by step instructions on setting this up: Setting Up AWS S3 Buckets + CloudFront CDN for your Assets


We are using the twig filter like this.

| replace({'http://s3-us-west-2.amazonaws.com/cranberrynm':'http://d15jwbqszojdqk.cloudfront.net'}) }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.