potato
potato

Reputation: 11

Error: There are no 'Deprecated_Private_NAT' subnet groups in this VPC. Available types: Public

Why am I getting this error when the subnet type that I'm trying to call is PRIVATE_WITH_NAT?

vpc_subnets = aws_ec2.SubnetSelection(
    subnets=vpc.select_subnets(subnet_type=aws_ec2.SubnetType(aws_ec2.SubnetType.PRIVATE_WITH_NAT)).subnets
),

Error Error: There are no 'Deprecated_Private_NAT' subnet groups in this VPC. Available types: Public

I tried to print the value of subnet type, but no deprecated_private_NAT.

print([t.value for t in aws_ec2.SubnetType])
['PRIVATE_ISOLATED', 'PRIVATE_WITH_EGRESS', 'PRIVATE_WITH_NAT', 'PUBLIC']

Upvotes: 1

Views: 747

Answers (1)

fedonev
fedonev

Reputation: 25739

In the CDK's (Typescript) source code, the string value of the SubnetType.PRIVATE_WITH_NAT enum is Deprecated_Private_NAT. I don't know how jsii converts this to Python.

In any case, PRIVATE_WITH_NAT is deprecated. Use PRIVATE_WITH_EGRESS instead.

Note, though, that the error message suggests your VPC only has Public subnets available.

Upvotes: 2

Related Questions