我想从另一个VPC使用Nat Gateway(不是EC2上的Nat Instance)来将我的stream量从对等的VPC路由到Internet。 我的基础架构如下所示:
/---------------------VPC-LIVECHAT---------------------\ | /---Subnet A---\ /---Subnet B---\ /---Subnet C---\ | | | | | | | | | | \-10.10.0.0/24-/ \-10.10.1.0/24-/ \-10.10.2.0/24-/ | \------------------------------------------------------/ | | | VPC Peering Connection | | | /----------------------VPC-COMMON----------------------\ | /---Subnet A---\ /---Subnet B---\ /---Subnet C---\ | | | /--------\ | | /--------\ | | /--------\ | | | | | NAT GW | | | | NAT GW | | | | NAT GW | | | | | \--------/ | | \--------/ | | \--------/ | | | \-10.10.3.0/24-/ \-10.10.4.0/24-/ \-10.10.5.0/24-/ | \------------------------------------------------------/ | | | VPC Peering Connection | | | /---------------------VPC-DATABASE---------------------\ | /---Subnet A---\ /---Subnet B---\ /---Subnet C---\ | | | | | | | | | | \-10.10.6.0/24-/ \-10.10.7.0/24-/ \-10.10.8.0/24-/ | \------------------------------------------------------/
我的想法:
我认为这个设置应该工作得很好,它只是路由VLAN。 但不是在AWS。 AWS不希望允许我在路由表中的不同VPC中使用Nat网关,但出现错误
“路由表rtb-293fa54d和接口接口-c2002e9e属于不同的networking”
我也不能在AWS中使用NAT网关的私有IP,AWS不会在路由目标中支持IP地址(我真的很想知道为什么)。
我正在使用CloudFormation,我的路由定义如下所示:
"RoutePrivate3ToNatInCommon" : { "Type" : "AWS::EC2::Route", "Condition" : "IsNotVpcCommon", "Properties" : { "DestinationCidrBlock" : "0.0.0.0/0", "RouteTableId" : { "Ref" : "PrivateSubnet3RoutingTable" }, "NatGatewayId" : { "Fn::GetAtt" : [ "NatGatewaySettingsForNotCommon", "NatGatewayAZC" ] } } }
NatGatewaySettingForNotCommon是我自定义的lambda支持的资源,它可以帮助我获得每个可用区的Nat网关列表。
有什么办法如何实现这个设置? 每个地区我将有大约10个VPCs,每个地区有3个私有子网,我真的不想设置30个全国网关。 这看起来像普通的“非多云”networking设置,所以在云中实现它应该没有问题。 还是呢?
AWS不支持这种types的configuration。 VPC对等不支持“多跳”路由。 以下configuration不支持通过VPC对等。
参考: 无效的VPC对等连接configuration