AWS News Blog

New CloudFront Feature: Invalidation

Voiced by Polly

Under normal conditions, an Amazon S3 object in a bucket that is part of a CloudFront distribution can be cached at a CloudFront edge location per the object’s TTL (Time to Live). In many situations it is possible to come up with a reasonable value for the TTL ahead of time. In other cases you may want the benefits of CloudFront’s caching but you may also need to make changes to the S3 object at unpredictable times.

We’ve just added a new invalidation function to the CloudFront API. You can now POST a list of one or more objects to a CloudFront distribution and the objects will be removed from all of the edge locations within minutes. The invalidation happens in an asynchronous fashion and you can have several invalidation requests pending at the same time.

You can use this new feature in many different ways. Here are some ideas:

  1. Update a CSS style sheet or some JavaScript that changes very infrequently.
  2. Remove a video that was not properly encoded.
  3. Remove information (e.g. a news story) that is inaccurate or no longer relevant.
  4. Remove information that is the subject of a DMCA takedown notice.

There are no charges for the first 1000 invalidations per month. After that, each one will cost you $0.005 (one half of one cent).

You can still use the TTL feature and you can also use versioned URLs. Both techniques are preferred when you have the ability to control or predict the proper hold time for an object. There’s no additional cost for either one, and there’s no need to wait for the invalidation to take effect (typically 10 to 15 minutes). Invalidation is appropriate when the hold time is unpredictable.

TTLs and versioned URLs are great when you have tight control over the object’s lifetime, with new objects replacing the old on a regular cycle or as part of a planned release. Invalidation is appropriate when objects can change with little or no notice.

The following third-party products already include support for this new feature:

Let me know if your product supports it, and I’ll amend this blog post to include it. Leave a comment or email me at awseditor@amazon.com.

The AWS Simple Monthly Calculator now supports CloudFront Invalidations and RDS Reserved DB Instances.

— Jeff;

Modified 2/9/2021 – In an effort to ensure a great experience, expired links in this post have been updated or removed from the original post.
Jeff Barr

Jeff Barr

Jeff Barr is Chief Evangelist for AWS. He started this blog in 2004 and has been writing posts just about non-stop ever since.