When it comes to provisioning and managing cloud resources, Infrastructure-as-Code (IaC) has quickly become the de-facto standard for development organizations. The ability to specify application infrastructure in a source-controlled language understood throughout the organization eliminates many of the conventional issues that separate software engineering and DevOps engineering.
Naturally, as cloud-based technologies continue their expansion, the tech that supports these cloud resources has matured in tandem. Released in 2019, AWS Cloud Development Kit (CDK) is the latest innovation in Amazon Web Services (AWS) application development that enables developers to write sound, reusable code and produce highly secure, consistent infrastructure, without the need to learn a complex and unfamiliar language.
In this article, we’ll take a closer look at the AWS CDK, and the key features and capabilities that make it such a powerful solution for cloud application development.
What is the AWS CDK?
AWS CDK is an open-source software development framework to define, manage, and provision cloud infrastructure in code. Unlike other development tools that require users to learn domain-specific languages, AWS CDK lets developers describe application infrastructure using a general-purpose language such as TypeScript, JavaScript, Python, C#, etc., and deploy using AWS CloudFormation.
The solution further enables the automation of AWS infrastructure with a large collection of higher-level constructs that preconfigure cloud resources with proven defaults, ensuring the implementation of best practices and driving developer collaboration through the sharing of reusable patterns.
Where did the AWS CDK come from?
The creation of the AWS CDK began with a project by the AWS development team who needed to build architecture deployed in multiple environments in a way that would enable them to develop and test in isolation and evolve independently if required.
While AWS CloudFormation was used to reliably and consistently provision the resources, the team realized that using YMAL/JSON was not the right approach for describing their system because the CoudFormation templates, although useful, lacked the necessary tools to express abstract ideas.
So they created a high-level, object-orientated abstraction that allowed them to work with the power of AWS CloudFormation but use Java instead of JSON. From there, they created classes that modeled individual AWS resources, so that they could quickly assemble these into reusable high-level concepts using a programming model called “constructs.” The project’s success served as proof-of-concept for the approach that led to the creation of the AWS CDK – available today as an open-source solution through Github.
How is AWS CDK different from other IaC tools?
With a multitude of IaC tools on the market, what makes AWS CDK such a powerful contender?
Well, before we can fully understand the advantages of the CDK, we need a better understanding of the complexity behind two of the biggest infrastructure definition options available today – CloudFormation and Terraform.
Both CloudFormation and Terraform are IaC tools that use a declarative approach to define cloud resources, relying primarily on markup-based configuration using JSON/YAML. However, because JSON/YAML are not actual programming languages, most developers are unfamiliar with them and lack native support for loops and functions, making maintaining big infrastructures increasingly difficult.
This is where the AWS CDK comes in.
Here are 3 key differentiators that set the AWS CDK apart:
- Functionality and Versatility.
The AWS CDK increases the number of resources that developers can manipulate through a code base, allowing developers to use features such as objects, conditional loops, string interpolation, conditions, etc., to better define their infrastructure. Furthermore, the CDK enables developers to centralize their infrastructure, application code, and configuration in a single repository, streamlining the development process from end-to-end.
- Speed & Portability. With the CDK, users are able to take advantage of existing skills and tools such as their preferred integrated development environment (IDE), in addition to preconfigured cloud resources, to quickly build and deploy cloud infrastructure that’s effective, reliable, and easy to maintain. Additionally, with the average CDK code being around 10-20 lines long, developers can essentially “write less and do more.”
- Customization & Reusability. The CDK also allows users to extend existing components in order to create custom components that satisfy security, compliance, and governance requirements of their organization. Furthermore, users can easily share these components throughout their organization, enabling them to quickly bootstrap new projects with default best practices.
What features does the AWS CDK include?
The CDK provides powerful capabilities that enhance the end-to-end development experience across 5 key features:
- The AWS Construct Library
AWS CDK provides access to a construct library with thousands of adjustable constructs that can be used to define applications’ infrastructure at a high level. Furthermore, the CDK enables developers to share and reuse customized constructs within their organization, which both accelerates the development process and ensures best practices by default.
- Deploy Infrastructure and Runtime Code Together
Infrastructure and runtime code can be deployed simultaneously with AWS CDK, which allows developers to use the same programming language and reference runtime code assets in the same project. When an application is deployed, the CDK framework automatically uploads and configures the AWS service in line with the runtime assets. Once deployment is complete, developers are left with a fully functional application.
- Powered by AWS CloudFormation
AWS CDK enables users to define their infrastructure with code and provision it through AWS CloudFormation. This means that developers are able to get the full advantages of CloudFormation – repeatable deployment, easy rollback, and drift detection – without the complexity.
- Developer-Friendly Command Line Interface (CLI)
The AWS CDK CLI allows users to easily interact with their CDK applications and further enhances functionality with features such as synthesizing a CloudFormation template, highlighting the differences between the current stack and proposed changes, assuring security-related changes prior to deployment, and deploying multiple stacks across multiple environments.
- Supports IDE Integration
Users can leverage their favorite development environments to get a bird’s eye view of their applications, infrastructure stacks, resources, and policies while utilizing testing tools and workflow patterns that are already in use on the CDK. Additionally, developers can spend less time moving between their code and the service documentation by leveraging the CDK’s autocomplete and in-line documentation capabilities.
Is the AWS CDK the right IAC tool for your business?
Describing infrastructure as code is one of the most powerful and efficient ways to manage the multitude of cloud resources that your systems use.
While there are many IaC options available, for organizations that use AWS as their cloud provider, the AWS CDK stands out as one of the most powerful, versatile, and accessible solutions for developers to manage, maintain, and deploy cloud resources without the frustration and complexity of working in a domain-specific language.
How can I learn more?
This article is part of a larger series focusing on the technologies and topics found in the first edition of the TechRadar by Devoteam. To see what our community of tech leaders said about the current position of the AWS CDK in the market, take a look at the most recent edition of the TechRadar by Devoteam
Want to know more about AWS CDK?
Check out TechRadar by Devoteam to see what our experts say about its viability in the market.