Skip to main content

cdk-stack-resource-rename

Project description

StackResourceRenamer

A CDK aspect, StackResourceRenamer renames CDK stack name and stack's subordinate resources' custom physical names, so that a CDK stack can be used to create multiple stacks in same AWS environment without confliction.

Sample

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
app = core.App()

stack = core.Stack(app, "my-stack")

alias = stack.node.try_get_context("alias")
if alias !== undefined:
    # if alias is defined, rename stack and resources' custom names
    # with the "rename" function/method.
    StackResourceRenamer.rename(stack,
        rename=(origName, _)=>{
                        return origName+'-'+alias;
                    }
    )

# resources in stack
bucket = s3.Bucket(stack, "bucket",
    bucket_name="my-bucket"
)

To create multiple stacks:

cdk -c alias=a1 deploy will create a stack: my-stack-a1 with my-bucket-a1.

To create more stacks: my-stack-a2 with my-bucket-a2, my-stack-a3 with my-bucket-a3:

cdk -c alias=a2 deploy

cdk -c alias=a3 deploy

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

cdk-stack-resource-rename-0.0.4.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file cdk-stack-resource-rename-0.0.4.tar.gz.

File metadata

  • Download URL: cdk-stack-resource-rename-0.0.4.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.9

File hashes

Hashes for cdk-stack-resource-rename-0.0.4.tar.gz
Algorithm Hash digest
SHA256 37f411989b15e5d94123d45f5b3fbd2df84e58348110a06450d7824a580e1beb
MD5 071c700d9ab5dbed4d7fe1ca7e981b75
BLAKE2b-256 70280179d2d24322cc1eb2661de8203ba3c1b580349f8e98359d42c9dbe915d2

See more details on using hashes here.

File details

Details for the file cdk_stack_resource_rename-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cdk_stack_resource_rename-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 57.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.9

File hashes

Hashes for cdk_stack_resource_rename-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9410f790b4a20f7441effdd5a0f4d74de2ec9e1daa1389aaede0aa00cf2b9959
MD5 2ea4348e760a3bdf928968ef598293f5
BLAKE2b-256 19098a80603627d8eed0c97ddec636d7862ed95a0599745389e8adee0e4f6619

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page