Skip to main content

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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reapit-cdk.replicated-secret-0.1.2.tar.gz (118.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reapit_cdk.replicated_secret-0.1.2-py3-none-any.whl (117.8 kB view details)

Uploaded Python 3

File details

Details for the file reapit-cdk.replicated-secret-0.1.2.tar.gz.

File metadata

File hashes

Hashes for reapit-cdk.replicated-secret-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3666179bbe7149a8bcf9370e1cb221fa7d58c2db0ef767641d60b62ac7dedc97
MD5 d844ec1e737ee62847b52b935831f8f8
BLAKE2b-256 9741728f1a13e3b184f554f8458a0464d7082cdd45f42170d4802e0adfe25abc

See more details on using hashes here.

File details

Details for the file reapit_cdk.replicated_secret-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for reapit_cdk.replicated_secret-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f378b34c339d75b2cba1e01c8451c5dfb9dacf0e6299c6860f73561c974c1b72
MD5 8809aea1f4e93d81e19dcdfe6bada248
BLAKE2b-256 b89c806c2852e2ec533952cef269bc5e6f62491c9c5a9b4a8c1dd336b48c39b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page