ec2.Vpc.from_lookup does not work when multiple private subnets are present
I'm submitting a :beetle: bug report
When retrieving an exisiting VPC using the ec2.Vpc.from_lookup classmethod, the call will fail if there are multiple private subnets present
Error message:
Not all subnets in VPC have the same AZs: ap-southeast-2a,ap-southeast-2b,ap-southeast-2c vs ap-southeast-2a,ap-southeast-2a,ap-southeast-2b,ap-southeast-2b,ap-southeast-2c,ap-southeast-2c
C:\AWS\Code\s3_test> cdk --version 1.1.0 (build 1a11e96) C:\AWS\Code\s3_test> python --version Python 3.7.4 OS: Windows 10
@RomainMuller @NGL321 seems like a dup
@eladb is this the correct classmethod to retrieve an existing VPC? Or is this depreciated?
Thanks James
Same problem here with Typescript and cdk version 1.1.0 yesterday and 1.2.0 today.
cdk diff ... results in
"Not all subnets in VPC have the same AZs: eu-west-1a,eu-west-1b vs eu-west-1a,eu-west-1a,eu-west-1b,eu-west-1b"
since we use
this._vpc = ec2.Vpc.fromLookup(this, 'global-**removed**-VPC', {
vpcId: 'vpc-**removed**',
});
Our subnet structure in that VPC: public in eu-west-1a / euw1-az3 public in eu-west-1b / euw1-az1 private in eu-west-1a / euw1-az3 private in eu-west-1b / euw1-az1 private in eu-west-1a / euw1-az3 private in eu-west-1b / euw1-az1
Best regards Oliver
If I understand @RomainMuller 's comment in #3407 , it needs to be a match on subnet counts as well, that is 2 Public and 2 Private.
this is not a bug; you can have public, private and isolated subnets. Make sure you have the account and region set in the variables or by o/s setting