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-ami-builder

v1.1.0

Published

AWS CDK construct for creating AMIs using [HashiCorp Packer](https://developer.hashicorp.com/packer/docs).

Downloads

3

Readme

AMI Builder

AWS CDK construct for creating AMIs using HashiCorp Packer.

This construct enables you to define a Packer build environment as part of your CDK project and use the built instances.

Usage

import { resolve } from 'path';
import { Duration } from 'aws-cdk-lib';
import { Schedule } from 'aws-cdk-lib/aws-events';
import { AmiBuilder } from 'cdk-ami-builder';

// ... within a construct

const builder = new AmiBuilder(this, 'MyCoolImageBuilder', {
    buildEnvDir: resolve(__dirname, '../my-image-build-env'),
    packerFileName: 'build.pkr.hcl',
    imagePrefix: 'my-cool-image',
    // Optional schedule for automated builds
    schedule: Schedule.rate(Duration.days(7)),
});

// This might be null if fhe first build hasn't completed yet
const myCoolImage = builder.latestImage;
if (myCoolImage) {
  new Instance(this, 'MyCoolInstance', {
    machineImage: myCoolImage,
  });
}

Force CDK to use the latest image version

By default, CDK will cache the AMI ID for builder.latestImage in cdk.context.json. You can override this behavior by running this command before cdk deploy:

cdk context -f --reset ami:*

This will force CDK to check for the latest image each time it synthesizes.

Construct Props

buildEnvDir

buildEnvDir: string

The path of the directory containing the Packer file and any build assets

See example-build-env for an example


buildEnvVars

Optional buildEnvVars: Record<string, string | ISecret | IParameter>

Additional environment variables to expose to Packer. The values may be plain strings, Secrets Manager secrets, or SSM parameters.


buildInstanceSubnet

Optional buildInstanceSubnet: ISubnet

The VPC subnet in which the Packer build instance should be launched

Default

No restriction on the subnet


imagePrefix

imagePrefix: string

A prefix string for the names of the built AMIs


packerFileName

packerFileName: string

The name of the Packer file, relative to buildEnvDir

See example.pkr.hcl for an example


rootDeviceName

Optional rootDeviceName: string

The name of the block device to which the root volume is mapped. In most cases this can be left unspecified.

Default

'/dev/sda1'


schedule

Optional schedule: Schedule

A schedule on which new image versions should be built automatically

Default

New versions are built only when the build definition changes