Interface VPC Endpoint Getting created without any subnet when used CDK

Viewed 921

I am trying to create an interface endpoint using CDK(version: 1.45) with subnet selection.

    this.endpoint = new ec2.InterfaceVpcEndpoint(this, `${props.dependentServiceConfig.name}Endpoint`, {
      service: new ec2.InterfaceVpcEndpointService(props.dependentServiceConfig.vpcEndpointServices[props.stage]),
      vpc: props.vpc,
      securityGroups: props.securityGroups,
      subnets: {
        subnetType: SubnetType.PRIVATE,
        availabilityZones: ['us-east-1a', 'us-east-1b']
      }
    });

When i create the same using console, its getting created with correct subnets and i am able to see us-east-1a and us-east-1b availability zones in aws console. But when i do the same thing using cdk code, my enpoint doesn't contain any subnets.

Documentation for the same : https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#choosing-subnets-for-resources

0 Answers
Related