Update (May 2026): Amazon CloudFront now natively supports tag-based cache invalidation — no additional infrastructure required. You can tag cached objects via origin response headers or S3 metadata and invalidate them by tag directly through the CloudFront API. For details, see the CloudFront Developer Guide and the launch blog post. If you are starting fresh, we recommend using the native feature instead of the solution described in this post.