Adam Woods
CTO & Co-founder
Trabr
/in/woodsae
woodsae
@woodsae
AWS CDK
(Cloud Development Kit)
Infrastructure in TypeScript
Overview
● What is infrastructure as code?
● Existing tools
● Intro to AWS CDK
DISCLAIMER
I am not a DevOps expert
Infrastructure as Code (IaC)
Infrastructure as Code
Came into existence in 2006 following the
launch of AWS
Infrastructure as Code
Infrastructure as code
!=
configuration management
Infrastructure as Code
Store in source control
Code reviews
Democratisation
Existing Tools
Cloudformation
Cloudformation
Created by Amazon in 2011
You write in YAML or JSON
Cloudformation
Designer
Cloudformation
● Lots of sample code
● State visualised in AWS
console
● Can be inlined with
serverless.yml
● Has a visual designer tool
● Verbose and hard to read
● No language features like loops
and math functions
● Importing files
● Not open-source
Pros: Cons:
Terraform
Terraform
Written in Go
You write in Hashicorp Configuration Language (HCL)
(or optionally JSON)
Created by Hashicorp in 2014
Terraform
Terraform
● Industry standard
● Good documentation
● Plenty of examples
● Shows diff before applying
changes
● Can create other things like
Github repos
● Custom DSL from Hashicorp
● IDE autocomplete support is
poor (at least in VS Code)
● Sharing of state
Pros: Cons:
AWS CDK
AWS CDK
Built on top of Cloudformation
You write in TypeScript
(or C#, F#, Java, JS, Python)
Created by Amazon in 2019
(v1.0.0 GA was released on July 12)
AWS CDK
INFRASTRUCTURE
BACKEND
FRONTEND
“Fuller” Stack Developers
AWS CDK
INFRASTRUCTURE
BACKEND
FRONTEND
“Fuller” Stack Developers
AWS CDK
AWS CDK
● Sample code from previous slide creates 26 resources in AWS
○ VPC, Subnets, Route Tables, RDS DB, Secret, NAT Gateway, Internet Gateway, EIP
● Code Size:
○ Cloudformation - 414 lines
○ Terraform - 165 lines
○ AWS CDK - 21 lines (including imports)
AWS CDK
● Write in TypeScript
● Helpful defaults to reduce code
● Code reuse
● Few examples and articles
● A bit buggy with destroying
stacks
Pros: Cons:
AWS icon quiz here:
https://bit.ly/2mu9wAs
THE END
Adam Woods
CTO & Co-founder
Trabr
/in/woodsae
woodsae
@woodsae

AWS CDK: Infrastructure in TypeScript

Editor's Notes

  • #24 Helpful defaults Creating a VPC will split your CIDR block and give you public and private subnets, a NAT gateway, and an Internet Gateway Code reuse Could have multiple AWS accounts which use the same code
  • #26 Helpful defaults Creating a VPC will split your CIDR block and give you public and private subnets, a NAT gateway, and an Internet Gateway Code reuse Could have multiple AWS accounts which use the same code