AWS DevOps Blog

CDK Corner – January 2021

December was an exciting month for CDK! Jason Fulghum delivered an AWS re:Invent presentation on how CDK has changed over the past year and what customers can expect in the next year. The highlight of this talk was the alpha release of CDK v2. This is the first major version bump since the AWS CDK went GA in July of 2019.

CDK v2 addresses two common pieces of feedback we received regarding dependency management with individually packaged modules. First, due to CDK being developed in the open, some modules are more or less mature than others but they are all equally available to install and use. Asking customers to verify the stability of every module they use directly and indirectly isn’t the kind of delightful experience we want customers to have. Second, explicitly installing a package for every service that’s needed can be quite cumbersome. CDK v2 will bundle all AWS CloudFormation L1 constructs and all stable L2 into a single package called aws-cdk-lib (code named “mono-cdk”). We will use a different model for annotating APIs that are not yet final without introducing breaking changes in minor versions. Additionally, all CDK constructs (AWS CDK, CDK8s, and CDKtf) will now inherit directly from a common Construct class. This change lays the foundation for sharing constructs across the CDK ecosystem.

Last month AWS Lambda announced container image support and this marked the first new AWS service feature which also launched on the same day with CDK support. This means that we were able to release an updated Lambda Function construct to support a new feature on the same day the feature was announced. I expect that we’ll see more features and services launching like this in the future.

Brand new L2 constructs were added for Amazon Interactive Video Service and CloudFront’s Lambda@Edge. This marks the start of the journey for these constructs that will eventually become stable and delightful enough to use for your production workloads. Speaking of the journey to stability, December saw three existing modules graduated to Stable. These modules are cloudfront, cloudfront-origins, and codeguruprofiler. Constructs marked as stable may include backward compatible changes only if the major version of CDK is incremented, and even then, most breaking changes will be removal of deprecated APIs from the previous version.

Finally, we get to my favorite part of this update. I’d like to take some time in each post to highlight a community member contribution and talk about how it makes the AWS CDK Community better. This month’s Contribution is PR #12090 by perennial CDK contributor Jonathan Goldwasser. This change adds a feature that will automatically remove the contents of an Amazon S3 Bucket when the bucket resource is removed from its CloudFormation stack. Before this feature was added, customers would need to manually empty a bucket of its contents for the bucket to be successfully deleted via CloudFormation. The coolest part of this contribution is that it both solves a real problem that customers experience and that the work was started by one community member and finished by another. People often think of open source software as the sum of individual contributions, but this specific pull request shows that collaboration takes many forms and contributions don’t always appear in the commit history.