-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VpcNetwork.importFromContext does not work if multiple private subnets are present #1523
Comments
I was able to use the same workaround VpcNetwork.Import with explicit AZ's to use instead of importFromContext which seems to fail trying to group all subnets/AZs after interrogating the VPC. |
Similar issue here but with different error message. import * as cdk from "@aws-cdk/cdk";
import * as ec2 from "@aws-cdk/aws-ec2";
export class PlayStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
ec2.VpcNetwork.importFromContext(this, "VPC", {
isDefault: true,
});
}
} Running I'm going to go out on a limb and suggest that If you create a standard VPC, eg: If my assumptions are correct it would be great to get the docs updated to reflect the differences between |
I'm seeing the same issue when trying to I'm going to open up a new issue, and will tag you in on it. |
I'm also running into a very similar issue when trying to import existing VPC's into my stack.
I'm using the very simple following code. import cdk = require("@aws-cdk/core");
import ec2 = require("@aws-cdk/aws-ec2");
export class RcsCdrInfrastructureStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpcId = "vpc-xxxxxxxx";
const vpc = ec2.Vpc.fromLookup(this, "MainVpc", { vpcId });
}
} It seems that This is currently stopping us from actually using CDK at all as we're unable to use our existing VPC's |
Confirmed - same issue in python CDK - cannot use ec2.Vpc.from_lookup when multiple private subnets are present |
I think this issue is to be closed mainly because the API doesn't exist any more. There could be further problems with |
I can also confirm that the |
The problem is confirmed to exist, above, in the from_lookup API |
Got same issue with new API |
Using the Typescript flavour of CDK, when trying to import a VPC defined outside CDK that has multiple private subnets
cdk synthesize
produces the following error messageNot all subnets in VPC have the same AZs: eu-west-1a,eu-west-1b vs eu-west-1a,eu-west-1a,eu-west-1a,eu-west-1b,eu-west-1b,eu-west-1b
:Using
VpcNetwork.Import
did successfully import the VPC but the documentation at the moment recomments usingVpcNetwork.importFromContext
.npm packages
@aws-cdk/cdk
and@aws-cdk/aws-ec2
version0.22.0
was used.0.21.0
also experienced the problem.The text was updated successfully, but these errors were encountered: