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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e26a7b429bcce576bfabde154bbe7bb3cdc5edf6e92ce7e1589b5846d5d5883e |
|
MD5 | d935e99b0444c5ce825ad6348aa586ff |
|
BLAKE2b-256 | 1f63fe53c678f5972ba69e65365bfa0baf4deedd88667f2f82823163f428b457 |
Close
Hashes for reapit_cdk.replicated_key-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f623697c243f07e0d979c3e4f088d66db29609f44c69e5c9fcbec15b5bd982a |
|
MD5 | cd86b91b5d8d605e3e7894c6551005dc |
|
BLAKE2b-256 | 947753f151067572bf362aaf37dd8b8628653456940ad40dfaf9efc4e060b343 |