Skip to main content

Allows you to share values between stack across regions and accounts.

Project description

@reapit-cdk/cross-region-stack-export

npm version npm downloads coverage: 71.85%25 Integ Tests: X

Allows you to share values between stack across regions and accounts.

Package Installation:

yarn add --dev @reapit-cdk/cross-region-stack-export
# or
npm install @reapit-cdk/cross-region-stack-export --save-dev

Usage

import { CfnOutput, Stack, App } from 'aws-cdk-lib'
import { CrossRegionStackExport } from '@reapit-cdk/cross-region-stack-export'
import { Bucket } from 'aws-cdk-lib/aws-s3'

const app = new App()
const euStack = new Stack(app, 'stack-eu', {
  env: {
    account: '11111111',
    region: 'eu-west-1',
  },
})

const exporter = new CrossRegionStackExport(euStack, 'exporter')
exporter.setValue('thing', 'avalue')

const bucket = new Bucket(euStack, 'bucket')
exporter.setValue('bucketArn', bucket.bucketArn)

const usStack = new Stack(app, 'stack-us', {
  env: {
    account: '2222222222',
    region: 'us-east-1',
  },
})

const importer = exporter.getImporter(usStack, 'eu-importer')

const euThing = importer.getValue('thing')
const euBucket = Bucket.fromBucketArn(usStack, 'eu-bucket', importer.getValue('bucketArn'))

new CfnOutput(usStack, 'euThing', {
  value: euThing,
})

new CfnOutput(usStack, 'euBucketName', {
  value: euBucket.bucketName,
})

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.cross-region-stack-export-0.1.2.tar.gz (121.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file reapit-cdk.cross-region-stack-export-0.1.2.tar.gz.

File metadata

File hashes

Hashes for reapit-cdk.cross-region-stack-export-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3fd8d16fa3ff5bb4f8a8eff7f93211b6b863d4072ba012e012596df5eec8da6a
MD5 87346f86000e780f5745aa78bb4f0bd9
BLAKE2b-256 0e948a738debc264868d5145648a628ba9271bee22199246169dae7bdb627dba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for reapit_cdk.cross_region_stack_export-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d29fb09a4f2b43a31826192e1056d6c7b55d12c1ea07deb8238ed4152ae103
MD5 26d37d44dfaa39b2de6e707df86f9635
BLAKE2b-256 1d63ed044082e03a3fc7984f34e911fe7512dcf70fc986b0983ab566d74b97db

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