@reapit-cdk/replicated-secret
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

@reapit-cdk/replicated-secret

npm version npm downloads coverage: 97.06%25 Integ Tests: ✔

Creates a Secret and replicates it across the given regions. Requires a ReplicatedKey be passed in.

Package Installation:

yarn add --dev @reapit-cdk/replicated-secret
# or
npm install @reapit-cdk/replicated-secret --save-dev

Usage

import { Stack, App } from 'aws-cdk-lib'
import { Function, Runtime, Code } from 'aws-cdk-lib/aws-lambda'
import { ReplicatedKey } from '@reapit-cdk/replicated-key'
import { ReplicatedSecret } from '@reapit-cdk/replicated-secret'

const app = new App()
const stack = new Stack(app, 'stack-name', {
  env: {
    region: 'us-east-1', // region must be specified
  },
})
const replicatedKey = new ReplicatedKey(stack, 'key', {
  replicaRegions: ['af-south-1', 'cn-north-1'],
})
const replicatedSecret = new ReplicatedSecret(stack, 'secret', {
  replicaRegions: ['af-south-1', 'cn-north-1'],
  replicatedKey,
})
const lambda = new Function(stack, 'lambda', {
  runtime: Runtime.NODEJS_18_X,
  handler: 'lambda.handler',
  code: Code.fromInline('export const handler = () => {}'),
  environment: {
    usSecretArn: replicatedSecret.getRegionalSecret('us-east-1').secretArn,
    afSecretArn: replicatedSecret.getRegionalSecret('af-south-1').secretArn,
    cnSecretArn: replicatedSecret.getRegionalSecret('cn-north-1').secretArn,
  },
})
replicatedSecret.grantWrite(lambda)

Readme

Keywords

Package Sidebar

Install

npm i @reapit-cdk/replicated-secret

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

139 kB

Total Files

10

Last publish

Collaborators

  • joshbalfour