Hands-On Infrastructure as Code: A Practical Guide to AWS CDK

Author

Erik Lundevall Zara

Published

April 25, 2025

Welcome

Welcome to the Hands-On Infrastructure as Code: A Practical Guide to AWS CDK book.

In this e-book, you will learn how to use the AWS Cloud Development Kit (CDK) to define and provision your cloud infrastructure in a programmatic, version-controlled way.

Whether you’re new to infrastructure as code or have some experience, this book will guide you through the process of creating and managing cloud resources using the AWS CDK in Python. By the end, you’ll be well on your way to have the practical skills and confidence to design, implement, and maintain infrastructure using modern development practices.

The book is divided into two parts - one for the basic introduction to using AWS CDK that is language agnostic. The other section go into the specifics of using Python to define and refine your infrastructure in AWS. The core concepts are the same, regardless of which supported programming language you use with AWS CDK.

In this book we focus on Python, a versatile and widely used language in many areas, including infrastructure, operations and tasks that many categorize as DevOps related tasks.

My hope is that you will find the material here useful for starting your journey with programmable infrastructure management in AWS, using Python.

AWS services used

We will deploy an EC2 virtual machine initially.

However, the book will focus deploying a simple demo application as a containerized service. Initially that will be with the AWS Service AppRunner, then we will do the same thing using AWS Elastic Container Sercice (ECS) Fargate. We will include practising test-driven-development (TDD) to some extent, and we will include adding monitoring and alerts.

The solution will evolve throughout the chapters of the book.

You can potentially incur some costs in AWS for this, but that should be quite small - and we will remind you to remove it also!

Code repository

The code in this book is also available in this GitHub repository:

https://github.com/cloudgnosis/hands-on-iac-awscdk-code

There is a separate directory for each chapter in the book in the repository.

License

Hands-On Infrastructure as Code: A Practical Guide to AWS CDK by Erik Lundevall Zara is licensed under CC BY-NC-ND 4.0