Skip to content

VPC “fromLookup” results in all Private Subnets and no Public Subnets #3405

@saudansari

Description

@saudansari

Using CDK v1.1.0 I'm trying to create an internet-facing Application Load Balancer.

When I call the ec2.vpc.fromLookup using my vpcId, i get all my subnets, but all of them come as PRIVATE Subnets. Due to this I get an error that there are no Public Subnets Available.

If I try using ec2.vpc.fromVpcAttributes using my vpcid, availabilityZones and SubnetIDs, i get the error "Cannot read property 'selectSubnets' of undefined".

Route Table of My Subnets: Within the Subnets, my RoutTable has two Routs:

Destination: 10.140.0.0/16, Target: Local, Status Active
Destination: 0.0.0.0/0, Target: internet-gateway, Status Active
I'm not sure whether my subnet/VPC configuration are incorrect or aws-cdk has a bug.

I've manually tried creating an Application Load Balancer with the public subnets and was able to create is successfully. So I can't say my subnet configs are incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions