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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aws-secrets-parser

v1.2.0

Published

Fetch and parse JSON from AWS secrets manager.

Downloads

1,077

Readme

AWS secrets parser

Fetch and parse JSON from AWS secrets manager.

Review Version Downloads Size Quality Coverage

Motivation

If I have a JSON secret:

{
  "username": "***",
  "password": "***"
}

I want to programmatically retrieve and parse it into an object:

import { retrieve } from "aws-secrets-parser";

retrieve("database-secret", "us-east-1").then(({ username, password }) => { ... });

I also want to format and export the values to environment variables:

> source <(aws-secrets-parser database-secret --naming constant --prefix DATABASE)
> printenv

DATABASE_USERNAME=***
DATABASE_PASSWORD=***

I also want to format and export them to a .env file:

> aws-secrets-parser database-secret --naming constant --prefix DATABASE --output dotenv > .env

This produces a .env file with:

DATABASE_USERNAME=***
DATABASE_PASSWORD=***

Installing

npm install aws-secrets-parser

To make the cli accessible install the package globally with the -g flag or invoke it with npx.

Usage

Fetch and parse a JSON secret:

import { retrieve } from "aws-secrets-parser";

retrieve("database-secret", "us-east-1");

CLI

aws-secrets-parser <name>

Fetch and parse JSON from AWS secrets manager.

Positionals:
  name  The secret name                                                                                         [string]

Options:
  -h, --help     Show help                                                                                     [boolean]
  -v, --version  Show version number                                                                           [boolean]
  -r, --region   Set the AWS region                                                      [string] [default: "us-east-1"]
  -n, --naming   Set the key naming format    [string] [choices: "preserve", "constant", "pascal"] [default: "preserve"]
  -p, --prefix   Add a prefix to the keys                                                                       [string]
  -o, --output   Set the output format                        [string] [choices: "export", "dotenv"] [default: "export"]

Naming formats:

  • preserve → No formatting
  • constantCONSTANT_CASE
  • pascalPascalCase

Output formats:

  • exportexport key='value'
  • dotenvkey=value

Examples

> aws-secrets-parser database-secret --naming constant --prefix DATABASE

export DATABASE_USERNAME='***'
export DATABASE_PASSWORD='***'

The cli prints export statements since you can't set environment variables from a script directly. Running the cli with source will consume them:

> source <(aws-secrets-parser database-secret --naming constant --prefix DATABASE)
> printenv

DATABASE_USERNAME=***
DATABASE_PASSWORD=***

You can also output them in dotenv format to consume later:

> aws-secrets-parser database-secret --naming constant --prefix DATABASE --output dotenv > .env

This produces a .env file with:

DATABASE_USERNAME=***
DATABASE_PASSWORD=***

Tooling

Dependencies

To install dependencies:

yarn install

Tests

To run tests:

yarn test

Documentation

To generate the documentation locally:

yarn docs

Linters

To run linters:

yarn lint

Formatters

To run formatters:

yarn format

Contributing

Please read this repository's Code of Conduct which outlines our collaboration standards and the Changelog for details on breaking changes that have been made.

This repository adheres to semantic versioning standards. For more information on semantic versioning visit SemVer.

Bump2version is used to version and tag changes. For example:

bump2version patch

Contributors

Remarks

Lots of love to the open source community!