Posts

Showing posts from June, 2022

Understanding AWS CDK, one stack at a time

Image
In one sentence: With AWS Cloud Development Kit (CDK), we write a program that produces a CloudFormation template. CloudFormation reads that template and creates or updates the resources in AWS. Keep that split in mind: the CDK application describes the infrastructure; CloudFormation builds it. The CDK command-line tool connects the two. 1. The problem Say we need a network, a load balancer, a Postgres database and an application running in Amazon Elastic Container Service (ECS). We have three ways to describe the setup. Configure it in the AWS console. We can create the resources, but repeating the setup and reviewing changes means keeping track of the individual settings ourselves. Write a CloudFormation template by hand. The setup becomes a file we can review and reuse. As we add roles, security groups, logs and connections, that file grows. Write a program that produces the template. That is CDK. We get functions, loops and types, and the output is still a file CloudFor...