Creates a Secret and replicates it across the given regions. Requires a [ReplicatedKey](../replicated-key/readme.md) be passed in.
Project description
@reapit-cdk/replicated-secret
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)
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-secret-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3666179bbe7149a8bcf9370e1cb221fa7d58c2db0ef767641d60b62ac7dedc97 |
|
MD5 | d844ec1e737ee62847b52b935831f8f8 |
|
BLAKE2b-256 | 9741728f1a13e3b184f554f8458a0464d7082cdd45f42170d4802e0adfe25abc |
Close
Hashes for reapit_cdk.replicated_secret-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f378b34c339d75b2cba1e01c8451c5dfb9dacf0e6299c6860f73561c974c1b72 |
|
MD5 | 8809aea1f4e93d81e19dcdfe6bada248 |
|
BLAKE2b-256 | b89c806c2852e2ec533952cef269bc5e6f62491c9c5a9b4a8c1dd336b48c39b9 |