cdk-remote-stack


Namecdk-remote-stack JSON
Version 0.1.35 PyPI version JSON
download
home_pagehttps://github.com/pahud/cdk-remote-stack.git
SummaryGet outputs from cross-regional AWS CDK stacks
upload_time2020-09-30 06:19:38
maintainer
docs_urlNone
authorPahud Hsieh<hunhsieh@amazon.com>
requires_python>=3.6
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![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)
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pahud/cdk-remote-stack.git",
    "name": "cdk-remote-stack",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Pahud Hsieh<hunhsieh@amazon.com>",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c3/d1/279178a868528ea90c54ed11227fd9e95c834fa173ef8f819247df1aea0d/cdk-remote-stack-0.1.35.tar.gz",
    "platform": "",
    "description": "[![awscdk-jsii-template](https://img.shields.io/badge/built%20with-awscdk--jsii--template-blue)](https://github.com/pahud/awscdk-jsii-template)\n[![NPM version](https://badge.fury.io/js/cdk-remote-stack.svg)](https://badge.fury.io/js/cdk-remote-stack)\n[![PyPI version](https://badge.fury.io/py/cdk-remote-stack.svg)](https://badge.fury.io/py/cdk-remote-stack)\n![Release](https://github.com/pahud/cdk-remote-stack/workflows/Release/badge.svg)\n\n# cdk-remote-stack\n\nGet outputs from cross-regional AWS CDK stacks\n\n# Why\n\nAWS CDK cross-regional cross-stack reference is not easy with the native AWS CDK construct library.\n\n`cdk-remote-stack` aims to simplify the cross-regional cross-stack reference to help you easily build cross-regional multi-stack AWS CDK apps.\n\n# Sample\n\nLet's say we have two cross-region CDK stacks in the same cdk app:\n\n1. **stackJP** - cdk stack in `JP` to create a SNS topic\n2. **stackUS** - cdk stack in `US` to get the Outputs from `stackJP` and print out the SNS `TopicName` from `stackJP` Outputs.\n\n```python\n# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826\nfrom cdk_remote_stack import StackOutputs\nimport aws_cdk.core as cdk\nimport aws_cdk.aws_sns as sns\n\napp = cdk.App()\n\nenv_jP = {\n    \"region\": \"ap-northeast-1\",\n    \"account\": process.env.CDK_DEFAULT_ACCOUNT\n}\n\nenv_uS = {\n    \"region\": \"us-west-2\",\n    \"account\": process.env.CDK_DEFAULT_ACCOUNT\n}\n\n# first stack in JP\nstack_jP = cdk.Stack(app, \"demo-stack-jp\", env=env_jP)\n\ntopic = sns.Topic(stack_jP, \"Topic\")\n\ncdk.CfnOutput(stack_jP, \"TopicName\", value=topic.topic_name)\n\n# second stack in US\nstack_uS = cdk.Stack(app, \"demo-stack-us\", env=env_uS)\n\n# ensure the dependency\nstack_uS.add_dependency(stack_jP)\n\n# get the stackJP stack outputs from stackUS\noutputs = StackOutputs(stack_uS, \"Outputs\", stack=stack_jP)\n\nremote_output_value = outputs.get_att_string(\"TopicName\")\n\n# the value should be exactly the same with the output value of `TopicName`\ncdk.CfnOutput(stack_uS, \"RemoteTopicName\", value=remote_output_value)\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Get outputs from cross-regional AWS CDK stacks",
    "version": "0.1.35",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "7f3b2195466d9600f9c026e5dc68b6c3",
                "sha256": "dbff78f9d72e3b0f3b3278aee3f2b1f55bab66093f7288c63b8100c65f682e53"
            },
            "downloads": -1,
            "filename": "cdk_remote_stack-0.1.35-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f3b2195466d9600f9c026e5dc68b6c3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 19730,
            "upload_time": "2020-09-30T06:19:37",
            "upload_time_iso_8601": "2020-09-30T06:19:37.691666Z",
            "url": "https://files.pythonhosted.org/packages/4c/3d/9ac16c42e5c92d971f45c21b4ba141ce0c600851b0817cee542203b40e6c/cdk_remote_stack-0.1.35-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "bdac299151c532eb832b49269de777c9",
                "sha256": "3bb21e0133d9f88862fa1d2dd8e032be55d44d94e1a247ba2ee4bcdca57256d9"
            },
            "downloads": -1,
            "filename": "cdk-remote-stack-0.1.35.tar.gz",
            "has_sig": false,
            "md5_digest": "bdac299151c532eb832b49269de777c9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 19625,
            "upload_time": "2020-09-30T06:19:38",
            "upload_time_iso_8601": "2020-09-30T06:19:38.985368Z",
            "url": "https://files.pythonhosted.org/packages/c3/d1/279178a868528ea90c54ed11227fd9e95c834fa173ef8f819247df1aea0d/cdk-remote-stack-0.1.35.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-09-30 06:19:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "pahud",
    "error": "Could not fetch GitHub repository",
    "lcname": "cdk-remote-stack"
}
        
Elapsed time: 0.15994s