understanding how Cloudfront invalidation batches are created

0

We have a lambda function which runs everytime any user uploads an image. It processes the image, creates multiple sizes, saves them to a S3 bucket and then invalidates a cloudfront which acts as a caching layer over the S3 bucket.

Since the lambda is run per image, I would be expecting that a CF invalidation batch that gets created would only have the different paths related to that image, but in practice I have observed that the invalidation batch sometimes has path for more than 1 image.

is this something that lambda / Cloudfront handles internally where it somehow clubs requests originating from different lambda runs in the same invalidation batch? is this expected behaviour?

1 Antwort
0

Hello,

According to the AWS Documentation, to invalidate files, you can specify either the path for individual files or a path that ends with the *wildcard, which might apply to one file or to many, as shown in the following examples:

For one image, you specifically mention the name of the image to invalidate; Example: /images/image1.jpg

Double check your invalidation to see if you have not used a wildcard such as /images/image* or /images/* which is a path for more than one image.

Please note that you can include the * wildcard at the end of the invalidation path, and using the wildcard invalidates multiple files such as all of the files in a directory or all files that begin with the same characters.

Please refer to this AWS documentation to Specify the files to invalidate.

I hope this helps.

Lunga T
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen