Skip to content
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

VPC:expicit passing availability zones produces errors #33089

Closed
1 task
gratinierer opened this issue Jan 23, 2025 · 4 comments
Closed
1 task

VPC:expicit passing availability zones produces errors #33089

gratinierer opened this issue Jan 23, 2025 · 4 comments
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. p3

Comments

@gratinierer
Copy link

Describe the bug

creating a VPC with subnets and passing the availabilty-zones explicit, fails when calling SubnetSelection

        self.vpc_config.subnet_private_interface_endpoints = aws_ec2.SubnetConfiguration(
            name='interface-endpoints',
            subnet_type=aws_ec2.SubnetType.PRIVATE_ISOLATED,
            cidr_mask=20)
        self.vpc_config.vpc_general = aws_ec2.Vpc(self, 'GeneralVpc',
                                                  vpc_name='vpc',
                                                  create_internet_gateway=True,
                                                  default_instance_tenancy=aws_ec2.DefaultInstanceTenancy.DEFAULT,
                                                  enable_dns_hostnames=True,
                                                  enable_dns_support=True,
                                                  flow_logs=None,
                                                  gateway_endpoints=None,
                                                  ip_addresses=aws_ec2.IpAddresses.cidr(self.ip_range_vpc),
                                                  ip_protocol=aws_ec2.IpProtocol.IPV4_ONLY,
                                                  availability_zones=[
                                                      'eu-west-1a',
                                                      'eu-west-1b'],
                                                  nat_gateway_provider=aws_ec2.NatProvider.gateway(),
                                                  nat_gateways=2,
                                                  subnet_configuration=[
                                                      self.vpc_config.subnet_private_interface_endpoints,
                                                  ],
                                                  restrict_default_security_group=True,
                                                  )
        aws_ec2.SubnetSelection(
            subnet_group_name=self.vpc_config.subnet_private_interface_endpoints.name)

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The code should work as it des with

max_azs=2

Current Behavior

RuntimeError: Error: There are no subnet groups with name '....' in this VPC. Available names:

Reproduction Steps

see code above

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.176.0 (build 899965d)

Framework Version

No response

Node.js Version

20.15.0

OS

win

Language

Python

Language Version

No response

Other information

No response

@gratinierer gratinierer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 23, 2025
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Jan 23, 2025
@pahud pahud self-assigned this Jan 24, 2025
@pahud
Copy link
Contributor

pahud commented Jan 24, 2025

aws_ec2.SubnetSelection(
            subnet_group_name=self.vpc_config.subnet_private_interface_endpoints.name)

what's happening here is that CDK would invoke SDK calls to find out that subnet_group_name, which I can't see the value, and it can't find that.

Please check:

RuntimeError: Error: There are no subnet groups with name '....' in this VPC. Available names:

  1. Are the Available names: in your specified VPC? If no, you might specify incorrect VPC. If yes, the VPC is correct defined and we'll need to find out why the SDK can't find the subnet_group_name
  2. You might want to use npx cdk diff -vv (double v) to view what's happening behind the scene. This would help you find out the root cause with more detailed debugging log.

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 labels Jan 24, 2025
@pahud pahud removed their assignment Jan 24, 2025
@pahud pahud removed the needs-triage This issue or PR still needs to be triaged. label Jan 24, 2025
@gratinierer
Copy link
Author

Hi pahud,
As noted: my complete stack(with 10 subnets and many other Stacks) works fine with „maxAz=2“. If i switch to explicit Az-definition „SubnetSelection“ fails for every subnet with the error.
„AvailableNames:“ are completely empty in this cases.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jan 25, 2025
@gratinierer
Copy link
Author

Sorry, error was on my side. The availybilty-zone was empty for some configuration reason, what produced this effect.
Thanks for your patient reaction!

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. p3
Projects
None yet
Development

No branches or pull requests

2 participants