<p>One way would be to manually clear it with <a href="https://superbig.co/plugins/cloudfront-invalidation" rel="nofollow noreferrer">Cloudfront Invalidation</a>.</p>

CC BY-SA 4.0
2019-06-13T09:29:10.990Z
Is there another option for Craft 3?
Javier García
CC BY-SA 4.0
2019-06-22T11:53:41.953Z
I believe its built in to the S3 plugin?
Fred Carlsen
CC BY-SA 3.0
2017-06-09T15:55:08.330Z
2017-06-09T15:55:08.330Z
Fred Carlsen
<p>Your best option for Craft 3 is to use <a href="https://putyourlightson.com/plugins/blitz" rel="nofollow noreferrer">Blitz</a> and the <a href="https://github.com/putyourlightson/craft-blitz-cloudfront" rel="nofollow noreferrer">Cloudfront Blitz Plugin</a>.</p>
<p>This combination will allow your craft instance to automatically expire CloudFront caches as needed, or clear the entire CloudFront cache from the CraftCMS CP.</p>

CC BY-SA 4.0
2021-09-16T15:56:59.047Z
Unless I'm missing something, Blitz only handles page caching, not assets?
RitterKnight
CC BY-SA 4.0
2021-09-16T18:42:21.987Z
That depends on your cloudfront configuration -- If you're serving assets via the same domain/server blitz can reset the entire cloudfront cache.
Philip Zaengle
CC BY-SA 4.0
2021-09-16T15:16:13.697Z
2021-09-16T15:16:13.697Z
Philip Zaengle
<p>I'm trying to get static assets set up to be served by CloudFront. I know how to get the S3 bucket working, and have CloudFront serving from that bucket, but what I can't wrap my head around is how to handle the invalidation. In non-Craft instances I know about hashing to trigger the invalidation, but not sure how to do that in Craft. </p>

<p>Specifically, if an editor uploads a photo named "photo.jpg", and then publishes, and decides to make a change and uploads the revised photo with the same name, how does CloudFront know that it has changed since the editors don't know about content hashing? </p>

<p>Hopefully this makes sense. While not at all new to Craft, I'm very new to running it with performance in mind and even newer to using a CDN. Any help is greatly appreciated!</p>

<cache>
Using Craft with CloudFront, and handling invalidation
# Using Craft with CloudFront, and handling invalidation

(Asked by: username_0 on 2017-06-09)

I'm trying to get static assets set up to be served by CloudFront. I know how to get the S3 bucket working, and have CloudFront serving from that bucket, but what I can't wrap my head around is how to handle the invalidation. In non-Craft instances I know about hashing to trigger the invalidation, but not sure how to do that in Craft.

Specifically, if an editor uploads a photo named "photo.jpg", and then publishes, and decides to make a change and uploads the revised photo with the same name, how does CloudFront know that it has changed since the editors don't know about content hashing?

Hopefully this makes sense. While not at all new to Craft, I'm very new to running it with performance in mind and even newer to using a CDN. Any help is greatly appreciated!

**Tags:** cache


---

## 2 answers

### Answer by username_1 on 2017-06-09. Score: 2 | Accepted answer

One way would be to manually clear it with [Cloudfront Invalidation](https://superbig.co/plugins/cloudfront-invalidation).

> **Comments:**
> **username_2**: Is there another option for Craft 3?  
> **username_1**: I believe its built in to the S3 plugin?  

---

### Answer by username_3 on 2021-09-16. Score: 1

Your best option for Craft 3 is to use [Blitz](https://putyourlightson.com/plugins/blitz) and the [Cloudfront Blitz Plugin](https://github.com/putyourlightson/craft-blitz-cloudfront).

This combination will allow your craft instance to automatically expire CloudFront caches as needed, or clear the entire CloudFront cache from the CraftCMS CP.

> **Comments:**
> **username_4**: Unless I'm missing something, Blitz only handles page caching, not assets?  
> **username_3**: That depends on your cloudfront configuration -- If you're serving assets via the same domain/server blitz can reset the entire cloudfront cache.  

---

