Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cdk-remote-stack

Package Overview
Dependencies
Maintainers
1
Versions
365
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdk-remote-stack

Get outputs from cross-regional AWS CDK stacks

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-5.92%
Maintainers
1
Weekly downloads
 
Created
Source

awscdk-jsii-template NPM version PyPI version Release

cdk-remote-stack

Get outputs from cross-regional AWS CDK stacks

Why

AWS CDK cross-regional cross-stack reference is not easy with the native AWS CDK construct library.

cdk-remote-stack aims to simplify the cross-regional cross-stack reference to help you easily build cross-regional multi-stack AWS CDK apps.

Sample

Let's say we have two cross-region CDK stacks in the same cdk app:

  1. stackJP - cdk stack in JP to create a SNS topic
  2. stackUS - cdk stack in US to get the Outputs from stackJP and print out the SNS TopicName from stackJP Outputs.
import { StackOutputs } from 'cdk-remote-stack';
import * as cdk from '@aws-cdk/core';
import * as sns from '@aws-cdk/aws-sns';

const app = new cdk.App();

const envJP = {
  region: 'ap-northeast-1',
  account: process.env.CDK_DEFAULT_ACCOUNT,
};

const envUS = {
  region: 'us-west-2',
  account: process.env.CDK_DEFAULT_ACCOUNT,
};

// first stack in JP
const stackJP = new cdk.Stack(app, 'demo-stack-jp', { env: envJP })

const topic = new sns.Topic(stackJP, 'Topic');

new cdk.CfnOutput(stackJP, 'TopicName', { value: topic.topicName })

// second stack in US
const stackUS = new cdk.Stack(app, 'demo-stack-us', { env: envUS })

// get the stackJP stack outputs from stackUS
const outputs = new StackOutputs(stackUS, 'Outputs', { stack: stackJP })

const remoteOutputValue = outputs.getAttString('TopicName')

// the value should be exactly the same with the output value of `TopicName`
new cdk.CfnOutput(stackUS, 'RemoteTopicName', { value: remoteOutputValue })

Keywords

FAQs

Package last updated on 09 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc