Amazon web services CloudFormation-用于Tansit网关的路由表路由传播
我正在使用CloudFormation创建以下资源: 专有网络 两个公共子网 两个专用子网 子网的路由表 我已使用我的on-prem office手动创建了站点到站点VPN。 我已经手动创建了传输网关,并将我的VPN连接到它。 现在,由于我将使用CloudFormation创建VPC,我认为为了避免手动操作,让VPC与Transit Gateway关联,并在CloudFormation脚本本身的路由表中传播路由。 请参阅以下代码片段以了解相同的内容:Amazon web services CloudFormation-用于Tansit网关的路由表路由传播,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我正在使用CloudFormation创建以下资源: 专有网络 两个公共子网 两个专用子网 子网的路由表 我已使用我的on-prem office手动创建了站点到站点VPN。 我已经手动创建了传输网关,并将我的VPN连接到它。 现在,由于我将使用CloudFormation创建VPC,我认为为了避免手动操作,让VPC与Transit Gateway关联,并在CloudFormation脚本本身的路由表中传播路由。 请参阅以下代码片段以了解相同的内容: VPCTransitGateayAtta
VPCTransitGateayAttachment:
Type: AWS::EC2::TransitGatewayAttachment
Properties:
SubnetIds:
- !Ref PrivateSubnet1
- !Ref PrivateSubnet2
TransitGatewayId: 'tgw-1234567890'
VpcId: !Ref VPC
#TransitGateWay Routes
TransitGateWayPublicRouteTableRoutes:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: '0.0.0.0/16'
TransitGatewayId: 'tgw-1234567890'
TransitGateWayPrivateRouteTable1Routes:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PrivateRouteTable1
DestinationCidrBlock: '0.0.0.0/16'
TransitGatewayId: 'tgw-1234567890'
TransitGateWayPrivateRouteTable2Routes:
Type: AWS::EC2::Route
Properties:
RouteTableId: !Ref PrivateRouteTable2
DestinationCidrBlock: '0.0.0.0/16'
TransitGatewayId: 'tgw-1234567890'
但在执行脚本时,我面临以下错误
The transitGateway ID 'tgw-1234567890' does not exist. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidTransitGatewayID.NotFound; Request ID: 30d31120-f9e2-4870-a378-55bc9a36f5bb)
用于AWS::EC2::路由资源。
我不明白是什么问题。说明AWS::EC2::Route的中转网关选项。
这里我还缺少什么?我在cloudformation中遇到了同样的问题,问题是路由必须等待AWS::EC2::TransitGatewayAttachment,我运行了cloudformation模板,其中所有需要TransitGatewayId参数的路由都被注释了,然后取消了对路由的注释,结果成功了 互联网网关附件需要这样做,但我的测试表明,TransitGateway附件也需要这样做
我们应该做的是添加一个DependsOn,这应该可以解决问题。哦..感谢您提供的信息,让我检查并实现此功能。我会尽快给你回复。