Skip to content

Cache invalidations with CloudFront and S3

0

We have a static file in a private bucket on S3. Which we usually update once a day (sometimes it can be updated within the day too)

We are serving this with CloudFront as CDN.. What I want to understand is, is there any setup where I can avoid the manual Invalidate API / CLI and make the CDN respect the ETag / Cache-Control and handle invalidations?

I enabled the policy that uses Cache-Control header from Origin instead of the CacheOptimised policy. With this setup, I end up getting the <Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message> message. I don't understand why changing CDN policy on how it handles the headers affects the request sent to S3.

1 Answer
2

Hi,

This article will provide a full solution with code to your problem: https://rewind.com/blog/automatic-cloudfront-invalidation-for-s3-origins/

Best,

Didier

EXPERT
answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.