The AWS CDK for software-defined deployments

Dreaming of Clouds

Just Build It, Already

From your (AWS authenticated) CLI in the root of the project, run:

$ npm run build
$ cdk deploy -c ENV=qa

You will get some absolutely beautiful log output (a small sample of my own output from a run is included in Figure 1), and within about three minutes, you'll have a VPC, subnets, routes, route tables, route table associations, and NAT gateways – all the building blocks of an AWS networking setup – neatly provisioned in your account.

Figure 1: Sample CDK log output.

Figure 2 shows the VPC section of my AWS console, which shows the VPC created by the CDK. You'll also notice that it's appropriately assigned a base CIDR, as defined for any qa environment in the cdk.json file (Listing 5).

Figure 2: VPC section of the AWS console.

Cleaning Up After Yourself

You now have code to provision a well-designed VPC, so what do you do now? Tear it down! Although it might seem counterintuitive to destroy these resources, your application CDK code is not quite ready, yet. (Come back for a future installment, where I show you how to build it out.) Until that code is ready, you can reap the cost-savings benefits of your infrastructure-as-code solution by tearing it down. From your CLI, the command

$ cdk destroy -c ENV=qa

should take care of destroying these resources until you're ready to come back and add on!


The AWS CDK provides an extremely flexible and powerful tool to fuel infrastructure-as-code solutions in the world of cloud-powered, API-driven infrastructure hosting. Even a jaded cloud architect can appreciate the power a tool like this has, to build bridges between development and cloud operations teams, where it seems previous tools have been less successful. Even better, it provides backward compatibility with CloudFormation, if needed. With support for C#, Java, and TypeScript, it offers programmers of different backgrounds the chance to leverage its power. I highly suggest giving the AWS CDK a try for your next project.


  1. Google Kubernetes Engine:
  2. Amazon EKS:
  3. Azure Kubernetes Service:
  4. AWS CloudFormation:
  5. CloudFormation function reference:
  6. Terraform announcement:
  7. Terraform license:
  8. CloudFormation drift detection:
  9. null_resource:
  10. External data sources:
  11. Writing custom providers:
  12. Troposphere:
  13. Sceptre:
  14. Ansible and AWS integration:
  15. AWS CDK Developer Preview:
  16. npm:
  17. Yarn:
  18. TypeScript:
  19. AWS CDK Toolkit docs:
  20. Code for this article:
  21. VPCs and subnets:

The Author

Bradley Campbell currently consults as a cloud architect. He has experience in software engineering, DevOps, cloud architecture, and data engineering and architecture across a variety of verticals, mostly focused in finance. Bradley holds all nine AWS certifications and two of three Google Cloud certifications, is a Jenkins Certified Engineer, and is CompTIA Security+ CE certified. His programming background is primarily centered around Python, Perl, Go, and JavaScript, although he is always keen on exploring new languages and skills to add to his toolbox. You can find him at or http://@geekmuse.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs

Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>


		<div class=