aws / aws/aws-cdk

(aws_apigatewayv2): VpcLink can't see Private_Isolated subnets

Open
#29,221 4 comments 0 reactions 1 assignee Claimed by @pahud View on GitHub
@aws-cdk/aws-apigatewayv2 bug effort/medium p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

VPC defined as:

```ts
this.vpc = new ec2.Vpc(this, 'Vpc', {
maxAzs: 2,
subnetConfiguration: [
{ cidrMask: 24, name: 'Isolated', subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
],
});
```

When trying to deploy the below APIGW definition:
```ts

const lb = new cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancer(this, 'lb', { vpc: props.vpc });
const listener = lb.addListener('Listener', { port: 80 });

listener.addTargets('ecs', {
port: 80,
targets: [props.backendService.loadBalancerTarget({
containerName: 'backend',
containerPort: 8000,
})],
});


const vpcLink = new cdk.aws_apigatewayv2.VpcLink(this, 'VpcLink', { vpc: props.vpc });

new cdk.aws_apigatewayv2.HttpApi(this, 'HttpProxyPrivateApi', {
apiName: 'BackendApi',
defaultIntegration: new HttpAlbIntegration('DefaultIntegration', listener, { vpcLink }),
});
}
```

### Expected Behavior

VpcLink is created using Isolated subnets automatically.

### Current Behavior

```
Error: There are no 'Private' subnet groups in this VPC. Available types: Isolated,Deprecated_Isolated
```

### Reproduction Steps

As above.

### Possible Solution

Workaround:
```ts
const vpcLink = new cdk.aws_apigatewayv2.VpcLink(this, 'VpcLink', { vpc: props.vpc, subnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED } });
```

### Additional Information/Context

_No response_

### CDK CLI Version

2.129.0

### Framework Version

_No response_

### Node.js Version

18.18.2

### OS

MacOS

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.