我在用python。
我可以提供一个VPC,但是nat实例出现在错误的子网中。我不知道如何使用nat_gateway_subnets参数。它似乎想要一个SubnetSelection --但是如果没有vpc对象,我看不出有什么方法可以做到这一点!?
有人能帮忙吗?谢谢。
类网络(cdk.Stack):
def __init__(self, scope: cdk.Construct, construct_id: str, cidr_range: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
self.vpc = ec2.Vpc(self, "VPC",
nat_gateway_subnets=??? ,
nat_gateways=3,
max_azs=3,
cidr=cidr_range,
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public-Firewall",
cidr_mask=25
),ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
cidr_mask=25
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PRIVATE,
name="Private-Primary",
cidr_mask=24
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PRIVATE,
name="Private-Secondary",
cidr_mask=24
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.ISOLATED,
name="Private-PrivateLink/AWS",
cidr_mask=25
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.ISOLATED,
name="Private-TGW",
cidr_mask=25
)
],
)发布于 2021-05-07 04:12:07
我想出来了:
nat_gateway_subnets=ec2.SubnetSelection(subnet_group_name="Public"),https://stackoverflow.com/questions/67428229
复制相似问题