Living Systems Handbook microservices as humans Bipin Singh
Growing a human from DNA

CDK is DNA

2 min readChapter 12 of 34By Bipin Singh

Every cell in your body contains the same DNA, and from it an entire, consistent body grows. Infrastructure as code gives software the same power: a description in code from which identical environments grow — again and again, in any account or Region. The AWS Cloud Development Kit (CDK) lets you write that DNA in a programming language you already know.

Why grow bodies from DNA instead of by hand?

Clicking through the AWS console is like assembling a person by hand: slow, error-prone, and impossible to reproduce exactly.

By hand (console) From DNA (CDK)
Steps live in someone's memory Steps live in Git, reviewed like code
Dev and prod drift apart Every environment grows from the same code
Hard to rebuild after a disaster cdk deploy regrows the whole body
Permissions written manually grant… methods generate least-privilege policies
Nobody knows why something exists Code + commit history explain it

How CDK works

Your TypeScript (DNA) ──cdk synth──► CloudFormation template (proteins) ──cdk deploy──► AWS resources (the living body)

CDK code is synthesised into AWS CloudFormation templates; CloudFormation then creates, updates or deletes resources safely, rolling back if something fails.

The building blocks

CDK concept Analogy What it is
App The whole society's genome The root of your CDK program
Stack A family that's deployed together A unit of deployment (one CloudFormation stack)
Construct A gene that builds an organ — or a whole human A reusable building block
L1 constructs Raw genetic letters Direct mappings of CloudFormation resources (CfnTable)
L2 constructs Genes with sensible defaults Friendly APIs with best-practice defaults (dynamodb.Table, NodejsFunction)
L3 constructs (patterns) Whole organs Multi-resource patterns (e.g. an API + function + table) — including your own
Key idea

In this handbook, one human = one construct. The Waiter construct contains everything the Waiter needs: memory, brain functions, senses, voice permissions and health alarms. Grow it once, reuse it anywhere.

The commands you'll use

Command What it does
cdk init app --language typescript Create a new project
cdk bootstrap One-time setup per account/Region (creates resources CDK needs to deploy)
cdk synth Generate the CloudFormation template (check your DNA)
cdk diff Show what will change before deploying
cdk deploy Grow or update the body in AWS
cdk destroy Remove the stack (careful with data!)

DNA mutations, safely

Changing CDK code and redeploying is like a controlled mutation: CloudFormation works out the minimal set of changes. A few rules keep mutations safe:

CDK vs other ways of writing DNA

CloudFormation (YAML/JSON), Terraform, Pulumi and the Serverless Framework solve the same problem. CDK's strengths: real programming languages (loops, types, functions), reusable constructs, and grant methods that make least privilege easy. Choose one and use it consistently — the habit of growing from code matters more than the tool.

Bipin Singh
Written by Bipin Singh

Senior Full-Stack Engineer · AI & AWS. I design and build serverless systems on AWS — and love explaining them simply.

Work with me