Stack

An CDK stack is the smalles single unit of deployment. It represents a collection of AWS resources that you define using CDK constructs. When you deploy CDK apps, the resources within a CDK stack are deployed together.

You define a stack by extending the Stack construct. The following example is a common pattern for defining a CDK stack. We define a constructor that accepts scope, id, and props

package com.myorg;

import software.constructs.Construct;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;

public class MyCdkStack extends Stack {

  public MyCdkStack(final Construct scope, final String id, final StackProps props) {
    super(scope, id, props);

    // Define your constructs here
  }
}

Above example only defines a stack. To create the stack it must be instantiated within the context of your CDK app.