Getting Started with AWS CDK

Artem Arkhipov, Full Stack Developer & Architect

Managing Your AWS Infrastructure

  • Manual -  using UI in AWS Web Console
  • Scripting -  using AWS CLI, SDK, or Query API 
  • From Template -  AWS CloudFormation
  • Coding Infrastructure Components -  AWS CDK

Infrastructure as Code

AWS CDK

Cloud

Development

Kit

Abstraction

Encapsulation

Reusable

Testable

Diff & Rollback

Publish

IDE features

Developer friendy

CDK Anatomy

CDK Toolkit (CLI)

Toolkit Stack

CDK Application

CDK Constructs

Level 1 Construct (L1)

*.ts

template.json

Level 2 Construct (L2)

*.ts

template.json

Level 2 Construct (L2)

*.ts

or the same:

Level 3 Construct (L3)

CDK in Action

  • AWS credentials/profile configured
  • Node & NPM installed

Demo Project

CI / CD

  • Use @aws-cdk/pipelines module
  • Create Pipeline Stack with Pipeline
  • Add stage/s with your app stack to the pipeline
  • Create Stage
  • Replace app stack with Pipeline stack in main file
  • Commit changes then deploy 
  • Destroy current stack

You'd Like to Know

L2/L3 Constructs don't restrict you

Override Cloudformation Properties

You'd Like to Know

Be careful with Identifiers

Changing construct id will delete or at least make resource orphan

...stupid cdk

You'd Like to Know

CDK Tokens

Token values are resolved during deployment time

What's next?

Thank you!

Artem Arkhipov

artem.arkhipov@techmagic.co

@ar_arkhipov

Getting Started with AWS CDK

By Artem Arkhipov

Getting Started with AWS CDK

  • 497