npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cdk-s3-event-invalidate-cloudfront-cache

v0.0.0

Published

When you have a website or application that uses Amazon CloudFront as a content delivery network (CDN) and Amazon S3 to store your images, you may want to ensure that whenever an image is updated or changed in the S3 bucket, the corresponding image in the

Downloads

186

Readme

CDK project for creating S3 bucket triggers and invalidating CloudFront cache

When you have a website or application that uses Amazon CloudFront as a content delivery network (CDN) and Amazon S3 to store your images, you may want to ensure that whenever an image is updated or changed in the S3 bucket, the corresponding image in the CloudFront cache is invalidated.

One way to achieve this is by using an AWS Lambda function that listens to changes in the S3 bucket, and then sends a request to the CloudFront API to invalidate the cache for the corresponding image.

To make sure that only the changed image is invalidated, you can use the S3 object key as a unique identifier, and pass it to the CloudFront invalidation API. This way, CloudFront knows exactly which object to invalidate in its cache, and will not accidentally invalidate other objects that have not been changed.

By invalidating the CloudFront cache for changed images in the S3 bucket, you can ensure that your users are always served the most up-to-date version of your images, without having to wait for CloudFront to expire the cached version. This can help improve the performance and user experience of your website or application.

About s3-event-invalidate-cloudfront-cache

This is a CDK project that creates a AWS Lambda function that listens to changes in an S3 bucket, and invalidates the corresponding objects in a CloudFront distribution cache.

Installation

yarn add cdk-s3-event-invalidate-cloudfront-cache

Or

npm install cdk-s3-event-invalidate-cloudfront-cache

Usage

Import the package

import {S3EventInvalidateCloudFrontCache} from 'cdk-s3-event-invalidate-cloudfront-cache';

Create a new S3EventInvalidateCloudFrontCache construct

    new S3EventInvalidateCloudFrontCache(this, "S3EventInvalidateCloudFrontCache", {
  bucketName: bucket.bucketName,
})

bucketName is the name of the S3 bucket that you want to listen to changes for, and it will invalidate the corresponding objects in the CloudFront distribution cache.

Language Supported

This project includes support for various programming languages and AWS services, including TypeScript, JavaScript, Python, Java, C#, and more. It also includes built-in support for popular AWS services such as AWS Lambda, AWS CloudFormation, AWS CloudFront, AWS S3, AWS API Gateway, and more.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.