Explain it simpler
The AWS CDK lets you describe your cloud setup by writing normal code, in languages like Python or TypeScript, instead of long configuration files. You build your setup from ready-made pieces called constructs, such as 'a storage bucket' or 'a function', and many pieces come with safe defaults. When you run the CDK, it turns your code into a CloudFormation template, the same kind of file AWS uses to build stacks, and then deploys it. Before the first deployment in an account and Region, you run a one-time setup command that creates a storage bucket and roles the CDK needs. It is like using a LEGO kit with instructions: you snap together labeled bricks, and the kit produces the full building plan for you.
At Bright Harbor Media, Leo maintains a 1,400-line YAML template for the photo-processing service. Every new environment means copying blocks, renaming them by hand and hoping nothing was missed. His lead suggests the team move to the AWS CDK so they can write infrastructure in Python, the same language as the application. Leo writes his first stack in an afternoon, types cdk deploy in a fresh account, and gets an error about a missing bootstrap stack and an assets bucket that does not exist. He did not create any bucket, so where is it supposed to come from, and what is the CDK actually deploying behind the scenes?
The AWS Cloud Development Kit (CDK) is an open-source framework for defining cloud infrastructure in general-purpose programming languages, including TypeScript, JavaScript, Python, Java, C# and Go. You write code that describes resources, and the CDK synthesizes that code into AWS CloudFormation templates, which CloudFormation then deploys. The appeal is that you gain the tools of programming, such as loops, conditions, functions, classes, package management, IDE autocompletion and unit tests, while keeping CloudFormation's safe, transactional stack management with rollback on failure.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 8 more sections, 8 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.