Posted On: Dec 2, 2021

The AWS Cloud Development Kit (AWS CDK) v2 for JavaScript, TypeScript, Java, Python, .NET and Go (preview) is now generally available in a single package, making it easier for you to use the CDK and stay up-to-date with new versions as we evolve it going forwards. AWS CDK v2 consolidates the AWS Construct Library into a single package called aws-cdk-lib, and eliminates the need to download individual packages for each AWS service used. If you write your own CDK construct libraries, you only need to take a minimum dependency on this single package and let library consumers choose which exact AWS CDK version to use.

AWS CDK v2 only includes stable APIs, which comply with Semantic Versioning (semver), so you can confidently update to new minor versions. The CDK follows the “release early, release often” philosophy to encourage community participation, and we will continue deliver new features via experimental APIs for your feedback. However, going forward, experimental modules will be distributed separately from aws-cdk-lib, versioned clearly to indicate their pre-release status, and will only be merged into aws-cdk-lib when mature and stable. 

In addition to simplified packing, the CDK includes developer productivity improvements such as a CDK API Reference refresh with code snippets throughout, CDK Watch for faster inner-loop development iterations on the application code (AWS Lambda handler code, Amazon ECS tasks, and AWS Step Function state machines) in your CDK project. You can also preserve successfully provisioned resources by disabling automatic stack rollbacks, further reducing deployment and iteration time. To find issues earlier in your infrastructure code development cycle, you can use the new assertions library to run automated unit tests in any CDK-supported language. 

Upgrading to AWS CDK v2, for most projects, can be accomplished with a one-time, safe re-bootstrapping of your AWS accounts and “import“ statement changes. To learn more, refer to the following resources: