@nona-creative/aws-cdk-vpc

AWS VPC package with CDK

Usage no npm install needed!

<script type="module">
  import nonaCreativeAwsCdkVpc from 'https://cdn.skypack.dev/@nona-creative/aws-cdk-vpc';
</script>

README

AWS VPC (CDK)

Installation

npm i -S @nona-creative/aws-cdk-vpc

Usage

  1. Create the VPC Stack

    this.vpcStack = new VPCStack(this.scope, `${this.id}-vpc-${this.stage}`, { stage: this.stage })
    

    This will also create a private and public Subnet and NAT Gateway, but no security groups.

  2. Create Security Groups as needed eg.

    this.vpcStack.createSecurityGroup({
      name: LAMBDA_VPC_SECURITY_GROUP_NAME,
      description: 'Lambda Security Group for app VPC',
    })
    this.vpcStack.createSecurityGroup({
      name: RDS_VPC_SECURITY_GROUP_NAME,
      description: 'RDS Security Group for app VPC',
      allowAllOutbound: false,
    })
    
  3. Create Ingress Rules as needed, eg.

    this.vpcStack.addSecurityGroupIngressRule({
      targetSecurityGroupName: RDS_VPC_SECURITY_GROUP_NAME,
      sourceSecurityGroupName: LAMBDA_VPC_SECURITY_GROUP_NAME,
      port: RDS_PORT,
    })