reapit-cdk.replicated-key 0.1.2

Creator: bradpython12

Last updated:

0 purchases

reapit-cdk.replicated-key 0.1.2 Image
reapit-cdk.replicated-key 0.1.2 Images

Languages

Categories

Add to Cart

Description:

reapitcdk.replicatedkey 0.1.2

@reapit-cdk/replicated-key




Creates a KMS key and replicates it to the desired regions. Useful when replicating secrets across regions.
Package Installation:
yarn add --dev @reapit-cdk/replicated-key
# or
npm install @reapit-cdk/replicated-key --save-dev

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

const app = new App()
const stack = new Stack(app, 'stack-name', {
env: {
region: 'us-east-1', // region must be specified
},
})
const key = new ReplicatedKey(stack, 'key', {
replicaRegions: ['af-south-1', 'cn-north-1'],
})

const lambda = new Function(stack, 'lambda', {
runtime: Runtime.NODEJS_18_X,
handler: 'lambda.handler',
code: Code.fromInline('export const handler = () => {}'),
environment: {
usKeyArn: key.getRegionalKey('us-east-1').keyArn,
afKeyArn: key.getRegionalKey('af-south-1').keyArn,
cnKeyArn: key.getRegionalKey('cn-north-1').keyArn,
},
})

key.grantEncryptDecrypt(lambda)

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.