aws / aws/aws-cdk

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

Open
#33,290 1 comment 1 reaction 0 assignees View on GitHub
effort/medium feature-request p2 package/tools
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### 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](https://pypi.org/project/moto/). 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

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the aws_cdk Stack APIs and the CDK CLI synthesis path described in the issue, then examine how Python, boto3, the AWS SDK for JavaScript, and moto could interact without intermediary templates. Done means a defined, supported way to deploy stacks directly from Python for moto-based integration tests, with its scope and compatibility clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.