AWS has recently announced the general availability of the CDK Toolkit Library. This new Node.js library allows developers to programmatically control the CDK to build additional automation around the CDK, exposing classes and methods to synthesize, deploy, and destroy stacks, among other capabilities.
The CDK Toolkit Library enables developers to perform CDK actions programmatically through code, rather than relying on CLI commands. Currently supported only in TypeScript, the library can be used to create custom tools, build specialized CLI applications, and integrate CDK capabilities into existing development workflows. Adam Keller, senior cloud architect at AWS, explains the main goal of the project:
Until now, the primary way to interact with the AWS CDK was through the CDK CLI, which presented challenges when building automation around the CDK as users couldn’t directly interact with the CDK toolkit natively in their code.
According to the documentation, the CDK Toolkit Library is suited for advanced infrastructure deployments, including automation within CI/CD pipelines, the creation of custom validation or approval steps, and the implementation of patterns across multiple environments.
The AWS CDK is an open-source framework that enables the definition of cloud infrastructure in code and its subsequent provisioning through AWS CloudFormation. It includes two main components: a class library for modeling infrastructure and a toolkit that provides either a command-line interface or a programmatic library to operate on those models.
The new Node.js library provides programmatic interfaces for the following six CDK actions: Synthesis, to generate CloudFormation templates and deployment artifacts; Deployment, to provision or update infrastructure; List, to view information about stacks and their dependencies; Watch, to monitor CDK applications for local changes; Rollback, to return stacks to their latest stable state; and Destroy, to remove stacks and associated resources. Keller adds:
The AWS CDK Toolkit Library opens up a whole new range of possibilities for platform engineers and developers who need finer grained control over how and when their infrastructure is deployed and tested.
Among the example scenarios provided, AWS highlights the automatic validation of application logic, maintaining ephemeral environments for integration or end-to-end testing, and cleaning up resources immediately after test completion to reduce cloud costs and configuration drift. Ran Isenberg, principal software architect at CyberArk and AWS Hero, comments:
While it’s a step in the right direction, I don’t think it replaces the deploy script we wrote to every stack. We have so many options that the CDK toolkit will not support, as it’s too specific to our needs and configurations.
More details are available on GitHub, including options to report bugs, provide feedback, share ideas, and request new features. The community has suggested exposing additional classes and functionalities, such as EnvironmentAccess, as potential future enhancements.
The CDK Toolkit Library is available in all regions where the AWS CDK is supported. A getting-started page provides instructions on how to install, configure, and customize the library.