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

@paulbarmstrong/cdk-managed-objects-bucket

v0.1.7-alpha

Published

A CDK construct representing a bucket and the objects within it, which can be defined by an Asset or directly in the CDK. It extends the Bucket construct.

Downloads

27

Readme

cdk-managed-objects-bucket

Experimental Notice

This package is brand new and highly experimental so breaking changes may be made without notice.

About

ManagedObjectsBucket is a CDK construct extending the Bucket construct to provide object management. An "object manager" custom CFN resource internal to the ManagedObjectsBucket construct mutates objects in the bucket to align the bucket with the objects defined in the CDK definition. The objects in the bucket are otherwise read-only.

Objects can be defined by:

  1. An Asset, by calling addObjectsFromAsset.
  2. CDK code, by calling addObject.

Benefits over BucketDeployment include:

  1. ManagedObjectsBucket has much stronger ownership of its objects in the bucket since it puts a layer of encapsulation around the bucket itself and does not let any other identities mutate objects within the bucket. That eliminates the possibility of the bucket's objects being mistaken as anything other than objects defined and managed by mechanisms within the CDK.
  2. ManagedObjectsBucket allows adding objects based on an Asset. That gives consumers more configurability than only allowing a local path to be specified. Asset allows consumers to, for example, run some code to bundle their local files as a part of the CDK synthesis process.
  3. ManagedObjectsBucket updates are multiple times faster than BucketDeployment updates. That's because BucketDeployment's default python runtime lambda function loads the entire AWS CLI in order to do aws s3 sync, while ManagedObjectsBucket's lambda function uses the s3-sync-client NPM package for it.
  4. ManagedObjectsBucket allows creating CloudFront invalidations after object updates without waiting for the invalidation to complete. That allows stack updates to be much faster for consumers who need to have an invalidation created when objects have been updated, but don't actually need to wait for it to complete.

Limitations

  1. The total size of objects in the bucket must not exceed 5 gigabytes.

Installation

npm install @paulbarmstrong/cdk-managed-objects-bucket

Usage

This is an example of how it may be used in a CDK app:

import * as cdk from "aws-cdk-lib"
import * as logs from "aws-cdk-lib/aws-logs"
import * as s3_assets from "aws-cdk-lib/aws-s3-assets"
import { ManagedObjectsBucket } from "@paulbarmstrong/cdk-managed-objects-bucket"
import { Construct } from "constructs"

export class MyStack extends cdk.Stack {
	constructor(scope: Construct, id: string, props?: cdk.StackProps) {
		super(scope, id, props)
		const bucket = new ManagedObjectsBucket(this, "Bucket", {
			bucketName: "my-example-managed-objects-bucket"
		})
		bucket.addObjectsFromAsset({
			asset: new s3_assets.Asset(this, "MyAsset", { path: "./my-local-files" })
		})
		bucket.addObject({
			key: "config.json",
			body: JSON.stringify({ "bucketArn": bucket.bucketArn })
		})
	}
}

Documentation

Please see the low level documentation for more details.

Issues

If you have any issue with the package I would like to hear about it. Please create an issue on GitHub.