Skip to content

Ability to deploy stacks directly without using the CDK CLI in order to facilitate testing with moto in Python #33290

Open
@mderner-ca

Description

@mderner-ca

Describe the feature

Extending aws_cdk Stacks to allow deploying of stack into cloud directly from Python with boto3.

Use Case

This would facilitate automated integration tests with the moto library. Currently the prevailing opinion online on how to perform this type of testing is to use the AWS CDK CLI to synth a CloudFormation template, ingest the template within Python and then translate that into something which can be deployed directly via boto3 within a moto decorated test. The fragility inherent in this approach is that it relies on you to synth the template prior to running tests, it requires you to create a method of consuming the CloudFormation template, and it requires you to create more methods specific to each form of infrastructure in order to accurately deploy them as described by the IAC.

If it were possible to integrate aws_cdk with boto3 to allow the deployment of infrastructure directly in Python, neither using the AWS CDK CLI nor using the intermediary CloudFormation templates then this would greatly improve the reliability and ease of using moto to perform integration tests against mock infrastructure.

Proposed Solution

Such a solution may not in fact have to integrate with boto3 since moto intercepts calls to the AWS APIs. The solution may suffice if aws_cdk leveraged the AWS SDK for JavaScript.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.177.0

Environment details (OS name and version, etc.)

Python3.13, macOS 15.3 (24D60), Apple M2

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions