Defining Cloud Infrastructure with the AWS Cloud Development Kit and Python

Lab Steps

Logging in to the Amazon Web Services Console
Initializing an AWS CDK Project in Python
Defining AWS Resources Using AWS CDK Resource Constructs
Synthesize and Deploy an AWS CloudFormation Stack with the AWS CDK Toolkit
Testing Your CDK Application

The hands-on lab is part of these learning paths

Ready for the real environment experience?

Time Limit1h 30m


The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework used to define your cloud application resources using familiar programming languages.

Before the AWS CDK, you had to rely heavily on AWS CloudFormation or AWS Serverless Application Model (AWS SAM) to define your cloud application resources, which required a decent understanding of YAML or JSON. The AWS CDK provides a programming model above these native template languages that increase productivity when developers are building out their infrastructure as code.

The AWS CDK includes a library of constructs that cover many AWS services and configurations as well as the CDK Toolkit, which you will learn to use for instantiating your application and deploying your resources to AWS CloudFormation.

In this lab, you will use these features of the AWS CDK Toolkit to create an AWS CloudFormation stack using the Python programming language.

The majority of the steps in this lab will be performed in a code IDE, but you will work in the AWS Console in the later stages of the lab to verify and test the resources spun up by the AWS CDK.

Learning Objectives

Upon completion of this beginner level lab, you will be able to:

  • Initialize a new AWS CDK project
  • Import and manage AWS Construct Library modules
  • Define AWS resources using the Python programming language
  • Use the AWS CDK Toolkit to synthesize and deploy an AWS CloudFormation template

Intended Audience

  • Cloud Architects
  • DevOps Engineers
  • Software Engineers


Familiarity with the following will be beneficial but is not required:

  • Python Programming
  • AWS Lambda
  • Amazon Simple Storage Service (S3)
  • AWS CloudFormation

The following courses and labs can be used to fulfill the prerequisite:


December 11th, 2021 - Addressed an issue with a version mismatch between the CDK library and the CDK CLI

Environment before
Environment after
About the Author
Learning paths4

Jun is a Cloud Labs Developer with previous experience as a Software Engineer and Cloud Developer. He holds the AWS Certified Solutions Architect and DevOps Engineer Professional certifications. He also holds the AWS Certified Solutions Architect, Developer, and SysOps Administrator Associate certifications. 

Jun is focused on giving back to the growing cloud community by sharing his knowledge and experience with students and creating engaging content.