Murtaza Hussain
Murtaza Hussain

Reputation: 4285

AWS Cloudfront cache invalidation paths usage

I am using s3 bucket as origin in cloudfront to cache and host my reactjs website.

After every deployment on s3 i want to invalidate the cache of my cloudfront distribution so that the user can get the latest build deployed..

Moreover, while reading the pricing of cloudfront invalidation, i want to make sure i don't exceed the free tier which is 1000 paths per month. Plus we don't have more then 10 or 20 deployments to production in a month.. and each deployment has around 500 files in directories:

enter image description here

So my question is: if i use "/*" as a invalidation query would it be considered as a 1 path ? or it would be 500 paths ?

Upvotes: 4

Views: 2461

Answers (2)

Murtaza Hussain
Murtaza Hussain

Reputation: 4285

The below excerpt which clarifies regarding the paths:

The charge to submit an invalidation path is the same regardless of the number of files you're invalidating: a single file (/images/logo.jpg) or all of the files that are associated with a distribution (/*). For more information, see Amazon CloudFront Pricing.

The text is taken from docs mentioned in the link below: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidation-specifying-objects-paths

which means that the "/*" is a single path.

Upvotes: 2

Vipulw
Vipulw

Reputation: 1283

I think the answer is the same link you provided in your question. Your question is whether wildcard is considered as 1 path or multiple part, so here is the screenshot for the same :

enter image description here

EDIT : For your confirmation, you can find the number of invalidations for a period of time by filtering the "Cost & Usage Report" (AWS console) by service="CloudFront" and usageType="Invalidations".

Hope this answers your question. Feel free to comment for any question.

Upvotes: 5

Related Questions