aws / aws/aws-cdk

[ec2-vpc]: SubnetSelection with AZs with vpc contruct in same application

Open
#27,540 4 comments 1 reaction 0 assignees View on GitHub
@aws-cdk/aws-ec2 documentation effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the issue

Hello team,

We identified an issue: the `.selectSubnets() `method doesn't function with `availabilityZones` when the VPC is within the same application, example snippet:

```
const supportedAZs = ['us-east-1d', 'us-east-1a', 'us-east-1c'];
const selectedSubnets = vpc.selectSubnets({
availabilityZones: supportedAZs,
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS
});

```
Upon verification, it's apparent that the AZ value acts as the TOKEN placeholder during the stack's synthesis, leading the above selectedSubnets to return empty. Notably, this operates correctly if the VPC is imported from an existing one.

Should this be intended behavior, might we request an update to the documentation, specifically regarding the `availabilityZones` parameter within the `SubnetSelection` interface, to prevent future confusion?

### Links

[e](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html)

Contributor guide

Open the contributing guide

Research direction

Start with the SubnetSelection availabilityZones documentation and the selectSubnets() entry point described in the issue. Reproduce the difference between a VPC created in the same application and an imported VPC during synthesis, then determine whether the intended result is a behavior fix or clarified documentation. Done means the AZ filter has defined, verified behavior and the linked documentation matches it.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.