[Python] How do I deploy a CDK stack that relies on SSM parameters from a different stack?

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    I was told that using SSM parameters is the best way to achieve stack independency and separation, but I'm running into the following issue:

    When I try to deploy my VPC stack for example, it throws an error that my Lambda stack is using an invalid S3 bucket name. The Lambda stack is supposed to get the bucket name after the S3 stack is deployed, where the SSM bucket name parameter will be created, but It doesn't seem to let me just deploy the stacks one by one in the correct order, as when I try to deploy or synth a single stack it evaluates all stacks.

    One way of resolving this I think would be chaining the stacks using the add_dependency Stack method, but that will link them in a manner I'm trying to avoid, as I'd like to be able to change stacks and deploy them without interacting with other stacks at all.

    A different "solution" would be manually adding temporary SSM parameters of the same name to avoid the error before the correct parameters are created and assigned, but that feels like a bad way to go about it as it wont scale well and is prone to errors.

    If my method is entirely wrong, please correct me on how to have automatically deployable stacks that are independent of each other while still referencing each other, cause I'm not able to find an answer to this specific question.

    Continue reading...

Compartilhe esta Página