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

@nona-creative/aws-cdk-config

v1.0.2

Published

AWS Config package

Downloads

6

Readme

AWS Config (CDK)

Installation

npm i -S @nona-creative/aws-cdk-config

Usage

  1. Create a config directory in the AWS CDK package that needs access to environment specific configuration variables

    +-- packages
        +-- some-api-aws-cdk
            +-- src
                +-- config
  2. Then add any of the following json files:

    • paramstore.json
    • secrets-manager.json
  3. Configure each of these config files as described in the Config Files below

Config Files

There are 2 ways to load environment specific configuration variables into a AWS CDK App, Stack or Construct using this package:

  1. from AWS Paramstore
  2. from AWS Secrets Manager

The resulting values from both approaches are returned together when you call loadConfig on the AWSConfig instance as follows:

const awsConfig = new AWSConfig(...)
const configData = awsConfig.loadConfig()

AWS Paramstore config file

src/config/paramstore.json

syntax:
{
  "<env name>": "<paramstore path>"
}
example:
{
  "EMAIL_FROM": "email/fromAddress"
}

The param store paths will have the App & Package names, as well as the stage prepended eg. the example above will become:

{
  "EMAIL_FROM": "/some-project/some-package/dev/email/fromAddress"
}

These are set in the .env file corresponding to the deployment stage, eg. if you are deploying some-api-aws-cdk to dev stage, then: pacakges/some-api-aws-cdk/.env.dev will contain App & Package names, eg.

APP_NAME=some-project
PACKAGE_NAME=some-api
usage:
import * as paramStoreKeys from '../config/aws-params.json'

const awsConfig = new AWSConfig(stack, `${id}-config`, {
  stage,
  paramStoreKeys,
})
const configData = awsConfig.loadConfig()
const { EMAIL_FROM } = configData

AWS Secrets Manager config file

src/config/paramstore.json

syntax:
{
  "<env name>": "<secret key>"
}
example:
{
  "PG_PASSWORD": "dbMasterPassword"
}
usage:

As well as providing the config as demonstrated above, you will also need to provide the AWS Secrets Manager Secret ARN when instantiating the AWSConfig class, do this by defining an SECRETS_ARN env in the .env file corresponding to the deployment stage, eg. in: pacakges/some-api-aws-cdk/.env.dev, add the following:

SECRETS_ARN=<your secret's ARN>

Then use this env when you instantiating the AWSConfig class:

import * as secretsManagerKeys from '../config/aws-secrets.json'

const awsConfig = new AWSConfig(stack, `${id}-config`, {
  stage,
  secretsManagerKeys,
  secretsArn: process.env.SECRETS_ARN,
})
const configData = awsConfig.loadConfig()
const { PG_PASSWORD } = awsConfig