@lamware/secrets-manager
v2.0.1
Published
Lamware Middleware for AWS Secrets Manager
Downloads
28
Readme
This Lamware Middleware utilizes the AWS Secrets Manager SDK to fetch and memoize secrets from AWS Secrets Manager.
Installation
This package is available via NPM:
yarn add @lamware/secrets-manager
# or
npm install @lamware/secrets-manager
Usage
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { secretsManager } from '@lamware/secrets-manager';
import { lamware } from '@lamware/core';
const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
.use(secretsManager<{ secret1: string; secret2: Record<string, string> }>({
region: 'us-east-2',
secrets: {
// You can provide a Secret Name
secret1: 'my-secret-123',
// Or a Secret ARN
secret2: 'arn:aws:secretsmanager:us-east-2:590000000000:secret:my-secret-123',
},
}))
.execute(async ({ state }) => {
const { secret1, secret2 } = state.secrets;
console.log(secret1, secret2);
return { statusCode: 200 };
});
export { handler };