Creates a KMS key and replicates it to the desired regions. Useful when replicating secrets across regions.
Project description
@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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for reapit-cdk.replicated-key-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e667b109cd2ae0fec207181d174f6a901a300758e41e13bbe9e6a9942cdc9cf |
|
MD5 | 5468ce5776c892c3863f9e3a91bc72d7 |
|
BLAKE2b-256 | bc2a6ab0f30e391d68f1cefef06a6f29696ae36d0ac75cc94b5a950a0a243e2e |
Close
Hashes for reapit_cdk.replicated_key-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1dfc23d0a19478029610199dc35dbff3d6c9a8504b30be9306a6673d3fefc51 |
|
MD5 | e5176f4a901bf3da577d5c5b0e20805c |
|
BLAKE2b-256 | 055012a221fb84e6f419e9b81d9c48d4ac455e3634beeffe36c23026408721f1 |