Fetch and parse JSON secrets from AWS Secrets Manager. Version 1.3.0. Provides a programmatic API (retrieve function) and a CLI for retrieving secrets as JSON objects, with options to format keys (constant, pascal, preserve), add prefixes, and output in JSON, shell export, or dotenv format. Includes built-in TypeScript type definitions. Release cadence: intermittent, mature stable. Differentiators: simple API, CLI with multiple output formats, no heavy abstraction layer.
npm install aws-secrets-parserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates using the retrieve function to fetch and parse a JSON secret from AWS Secrets Manager.
Ensure your AWS secret is stored in JSON format. Use the CLI with output json to debug.
Ensure you have v3 of the AWS SDK installed as a peer dependency.
Use type assertion: const secret = await retrieve<{ username: string; password: string }>('...');Set environment variables or use AWS profiles.
Run: source <(aws-secrets-parser secret --output export)
Use import { retrieve } from 'aws-secrets-parser'Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION.
Ensure the secret is JSON format in AWS Secrets Manager and the name is correct.