Skip to content
🔑 High level interface (with cache) for AWS Secrets Manager
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
src
test
.eslintrc.js
.gitignore
README.md
package.json

README.md

aws-secrets-manager

Maintainability

🔑 High level interface (with cache) for AWS Secrets Manager

Install

npm install @lfreneda/aws-secrets-manager --save

How to use

const { SecretsManager } = require('@lfreneda/aws-secrets-manager')
const secretsManager = new SecretsManager({ region: 'us-east-1' })
const secretValue = await secretsManager.getSecretValue('sample/key')

There is also a in memory cache implementation as "Decorator pattern" using node-cache package:

const { SecretsManager, InMemoryCacheSecretsManagerDecorator } = require('@lfreneda/aws-secrets-manager')
const secretsManager = new SecretsManager({ region: 'us-east-1' })
const cachedSecretManager = new InMemoryCacheSecretsManagerDecorator(secretsManager) 
const secretValue = await cachedSecretManager.getSecretValue('sample/key')

When using InMemoryCacheSecretsManagerDecorator results from aws secret manager service will be cached for 5 minutes :)

If you are using secrets for RDS credentials, there is also a helper to convert db settings to connection string: toConnectionString

Running tests

You should have installed jest as global npm install jest -g and then just run:

npm test
You can’t perform that action at this time.