# How to setup cloudfront for discourse

**URL:** https://meta.discourse.org/t/how-to-setup-cloudfront-for-discourse/129252
**Category:** Support
**Created:** [September 22, 2019, 9:20pm UTC](https://meta.discourse.org/t/how-to-setup-cloudfront-for-discourse/129252 "2019-09-22T21:20:38Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [May 3, 2020, 8:11am UTC](https://meta.discourse.org/t/how-to-setup-cloudfront-for-discourse/129252/6 "2020-05-03T08:11:06Z")

</div>

@Magnetidog I just got it to work.

I basically created the AWS Cloudfront distribution as explained in [this video](https://www.youtube.com/watch?v=KIltfPRpTi4).

Then, I went to the admin panel and added my Cloudfront URL to the `s3 cdn url` key.

Then, I entered the container and rebaked all posts with `rake posts:rebake` (it took me around 10 min for every 7000 posts).

I also tried doing it in batches in the Rails Console, but for some reason this didn’t work: `Post.in_batches.update_all('baked_version = NULL')` (nothing happened 🤷🏻‍:male\_sign:)

---

_[View the full topic](https://meta.discourse.org/t/how-to-setup-cloudfront-for-discourse/129252)._
