What is invalidation requests amazon cloudfront ?
Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to your users.
CloudFront delivers your content through a worldwide network of data centers called edge locations. When a user requests content that you're serving with CloudFront, the request is routed to the edge location that provides the lowest latency.
What is Cloudfront ?
The AWS Content Delivery Network (CDN), also known as CloudFront, is used to provide quicker access to content in faraway places. When you require quick access to content from diverse geographical regions, CloudFront is ideal because it has hundreds of edge nodes serving your content.
Amazon Cloudfront invalidation :
Amazon CloudFront allows you to to remove one or multiple files from all edge locations prior to the expiration date set on those files. The invalidation feature is helpful in unexpected circumstances, for instance an occasional update to your website's css file, in which you need to remove the file from Amazon CloudFront. Invalidation can also be helpful in the event that offensive or potentially harmful material needs to be removed before the specified expiration time.
Automatic Invalidation :
One way to handle invalidation is to have a side process that runs whenever you upload new content to the origin. But what if you want to get content into the origin via other means? If you’re using S3 as the content origin, you can take advantage of AWS Events to trigger the invalidation. That’s the solution we created here and found a couple of hurdles along the way which we’ll cover here.
We used AWS SAM to package up a solution for the automation invalidation. If you’re not familiar with SAM, have a read of this article on using it to create a Slack DJ. SAM lets you develop and test Lambda-based solutions locally with ease and then deploy them as an application. In our example here, the solution needs to:
- Create a Lambda function
- Finds the CloudFront distribution associated with a given S3 bucket
- Submits an invalidation request for any changed files in this bucket
- Subscribe the Lambda function to any file modification events on the S3 bucket

Comments
Post a Comment