cdk-remote-stack


Namecdk-remote-stack JSON
Version 0.1.135 PyPI version JSON
download
home_pagehttps://github.com/pahud/cdk-remote-stack.git
SummaryGet outputs from cross-regional AWS CDK stacks
upload_time2021-02-02 06:08:27
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

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)

cdk.CfnOutput(stack_jP, "TopicName", value="foo")

# 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)
```

## always get the latest stack output

By default, the `StackOutputs` construct will always try to get the latest output from the source stack, you may opt out by setting `alwaysUpdate` to `false` to turn this feature off.

For example:

```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
outputs = StackOutputs(stack_uS, "Outputs",
    stack=stack_jP,
    always_update=False
)
```



            

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/23/5a/e608e91cb55bf34270356f42c03dbb78773854a6578d01e0576c267bd31b/cdk-remote-stack-0.1.135.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\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\ncdk.CfnOutput(stack_jP, \"TopicName\", value=\"foo\")\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## always get the latest stack output\n\nBy default, the `StackOutputs` construct will always try to get the latest output from the source stack, you may opt out by setting `alwaysUpdate` to `false` to turn this feature off.\n\nFor example:\n\n```python\n# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826\noutputs = StackOutputs(stack_uS, \"Outputs\",\n    stack=stack_jP,\n    always_update=False\n)\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Get outputs from cross-regional AWS CDK stacks",
    "version": "0.1.135",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a03effc4c4101c91e6b7470a6472d5fc",
                "sha256": "60bd9bee6d06eecb0119d0a57898d4cdadfb3b6ca71ce10cf8ed6254d2d26a24"
            },
            "downloads": -1,
            "filename": "cdk_remote_stack-0.1.135-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a03effc4c4101c91e6b7470a6472d5fc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 45968,
            "upload_time": "2021-02-02T06:08:25",
            "upload_time_iso_8601": "2021-02-02T06:08:25.739081Z",
            "url": "https://files.pythonhosted.org/packages/95/10/6d477494855756d07e691c85e59dc94bbcb557490ef48ba642800016a5b9/cdk_remote_stack-0.1.135-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "e021976679c0f2a7d22b6ea8ae1286b0",
                "sha256": "7e6e19734beab6bbba5680808f5d6b1fee656d61ceeeaf1d0ad8c4e1d0ad025d"
            },
            "downloads": -1,
            "filename": "cdk-remote-stack-0.1.135.tar.gz",
            "has_sig": false,
            "md5_digest": "e021976679c0f2a7d22b6ea8ae1286b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 47226,
            "upload_time": "2021-02-02T06:08:27",
            "upload_time_iso_8601": "2021-02-02T06:08:27.524179Z",
            "url": "https://files.pythonhosted.org/packages/23/5a/e608e91cb55bf34270356f42c03dbb78773854a6578d01e0576c267bd31b/cdk-remote-stack-0.1.135.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-02-02 06:08:27",
    "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.21026s