![](/img/trans.png)
[英]Cloudformation: VPC Routing table with No Route for Internet Gateway
[英]CloudFormation - Route Table route Propagation for Tansit Gateway
我正在使用 CloudFormation 創建以下資源:
我已經在我的本地辦公室手動創建了一個站點到站點 VPN。 我手動創建了中轉網關並將我的 VPN 連接到它。 現在,由於我將使用 CloudFormation 創建 VPC,我想避免手動工作讓 VPC 關聯到 Transit Gateway 並在 CloudFormation 腳本本身的路由表中傳播路由。 請參考以下代碼片段:
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::Route資源。 我無法理解是什么問題。 該文檔說明了 AWS::EC2::Route 的 Transit Gateway 選項。 我在這里還缺少什么?
我在 cloudformation 中遇到了同樣的問題,問題是路由必須等待AWS::EC2::TransitGatewayAttachment
,我運行了 cloudformation 模板,其中包含所有需要 TransitGatewayId 參數注釋的路由,然后取消注釋路由,然后工作。
有文檔表明 Internet 網關附件需要這樣做,但我的測試表明,TransitGatewayAttachments 也需要這樣做。
我們應該做的是添加一個 DependsOn,這應該可以解決問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.