Home > Mobile >  manually invalidate cache in aws cloudfront for more than 3000 files
manually invalidate cache in aws cloudfront for more than 3000 files

Time:04-29

What happens if I want to manually invite more than 3000 files to my distribution?

documentation (doc)

Concurrent invalidation request maximum

If you’re invalidating files individually, you can have invalidation requests for up to 3,000 files per distribution in progress at one time. This can be one invalidation request for up to 3,000 files, up to 3,000 requests for one file each, or any other combination that doesn’t exceed 3,000 files. For example, you can submit 30 invalidation requests that invalidate 100 files each. As long as all 30 invalidation requests are still in progress, you can’t submit any more invalidation requests. If you exceed the maximum, CloudFront returns an error message.

If you’re using the * wildcard, you can have requests for up to 15 invalidation paths in progress at one time. You can also have invalidation requests for up to 3,000 individual files per distribution in progress at the same time; the maximum on wildcard invalidation requests allowed is independent of the maximum on invalidating files individually.

they indicate that more than 3000 files cannot be invalidated simultaneously

What happens when I invalidate a wildcard path that includes more than 3000 files?

Only the first 3000 are invalidated? and the rest?

does it issue any warning? invalidate batches of 3000 files until you invalidate the entire distribution?

CodePudding user response:

They indicate that more than 3000 files cannot be invalidated simultaneously

Correct, the maximum limit for invalidating files separately is currently 3,000 per distribution at the same time (whether that’s in 1 invalidation request or 10).

If you exceed the maximum, CloudFront returns an error message and will not process the batch which pushes your account over the quota.

For example, a batch of 5000 files results in none being invalidated however 2 batches of 2900 & 2100 files results in the first 2900 files being invalidated and the rest discarded.

What happens when I invalidate a wildcard path that includes more than 3000 files?

The key point to note here is that wildcard invalidation is different from individual file(s) invalidation as per official documentation:

The maximum on wildcard invalidation requests allowed is independent of the maximum on invalidating files individually.

If you’re using the * wildcard, you can have requests for up to 15 invalidation paths in progress at one time, running at the same time as other invalidation requests running for individual file(s).

If you exceed the maximum, CloudFront returns an error message with behaviour mirroring the above.


Individual file invalidation is usually for specific versioned files - if you're invalidating more than 3000 files regularly, something is wrong with your setup.

Use wildcards instead.

  • Related