Metadata-Version: 2.1
Name: cdk-remote-stack
Version: 0.1.81
Summary: Get outputs from cross-regional AWS CDK stacks
Home-page: https://github.com/pahud/cdk-remote-stack.git
Author: Pahud Hsieh<hunhsieh@amazon.com>
License: Apache-2.0
Project-URL: Source, https://github.com/pahud/cdk-remote-stack.git
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aws-cdk.aws-iam (<2.0.0,>=1.62.0)
Requires-Dist: aws-cdk.aws-lambda (<2.0.0,>=1.62.0)
Requires-Dist: aws-cdk.aws-logs (<2.0.0,>=1.62.0)
Requires-Dist: aws-cdk.aws-sns (<2.0.0,>=1.62.0)
Requires-Dist: aws-cdk.core (<2.0.0,>=1.62.0)
Requires-Dist: aws-cdk.custom-resources (<2.0.0,>=1.62.0)
Requires-Dist: constructs (<4.0.0,>=3.0.4)
Requires-Dist: jsii (<2.0.0,>=1.14.1)
Requires-Dist: publication (>=0.0.3)

[![awscdk-jsii-template](https://img.shields.io/badge/built%20with-awscdk--jsii--template-blue)](https://github.com/pahud/awscdk-jsii-template)
[![NPM version](https://badge.fury.io/js/cdk-remote-stack.svg)](https://badge.fury.io/js/cdk-remote-stack)
[![PyPI version](https://badge.fury.io/py/cdk-remote-stack.svg)](https://badge.fury.io/py/cdk-remote-stack)
![Release](https://github.com/pahud/cdk-remote-stack/workflows/Release/badge.svg)

# 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.

```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_remote_stack import StackOutputs
import aws_cdk.core as cdk
import aws_cdk.aws_sns as sns

app = cdk.App()

env_jP = {
    "region": "ap-northeast-1",
    "account": process.env.CDK_DEFAULT_ACCOUNT
}

env_uS = {
    "region": "us-west-2",
    "account": process.env.CDK_DEFAULT_ACCOUNT
}

# first stack in JP
stack_jP = cdk.Stack(app, "demo-stack-jp", env=env_jP)

topic = sns.Topic(stack_jP, "Topic")

cdk.CfnOutput(stack_jP, "TopicName", value=topic.topic_name)

# second stack in US
stack_uS = cdk.Stack(app, "demo-stack-us", env=env_uS)

# ensure the dependency
stack_uS.add_dependency(stack_jP)

# get the stackJP stack outputs from stackUS
outputs = StackOutputs(stack_uS, "Outputs", stack=stack_jP)

remote_output_value = outputs.get_att_string("TopicName")

# the value should be exactly the same with the output value of `TopicName`
cdk.CfnOutput(stack_uS, "RemoteTopicName", value=remote_output_value)
```


