AWS CDK

  • Open source software framework to model and provision your cloud application resources using familiar languages.

Supported Languages

  • TypeScript/Javascript
  • Python
  • Java
  • C#

Workflow

  1. Initialize CDK project: cdk init --language=typescript
  2. Write Code - code your infrastructure using one of supported languages above
  3. Synthesize - produces CloudFormation templates for the written code: cdk synth
  4. Deploy - deploys CloudFormation template as stack to your AWS account: cdk deploy

Examples

Github: Creating Highly Available Network using AWS CDK + TypeScript

import * as cdk from '@aws-cdk/core';
import { Peer, Port, SecurityGroup, SubnetType, Vpc } from '@aws-cdk/aws-ec2'


export class AppStack extends cdk.Stack {


  params = {
    'cidr': '10.10.0.0/16'
  }

  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const vpc = new Vpc(this, 'HAVpc', {
      cidr: this.params.cidr,
      maxAzs: 3,
      subnetConfiguration: [{
        cidrMask: 26,
        name: 'isolatedSubnet',
        subnetType: SubnetType.ISOLATED
      }]
    })
  }
}