【问题标题】:Route did not stabilize in expected time The following resource(s) failed to create NATRoute . Rollback requested by user路由未在预期时间内稳定以下资源未能创建 NATRoute。用户请求回滚
【发布时间】:2019-07-03 09:15:06
【问题描述】:

我正在尝试创建 CloudFormation 堆栈,它将创建 VPC、子网、IGW、路由表、NAT 网关、将子网与 RT 关联等

我的堆栈失败,其中 NAT 网关尝试为私有路由表创建规则以创建 NAT GW 的路由规则。

  # Punblic Elastic IP for NAT Gateway in Zone 2A
  eipSubnetA:
    Type: AWS::EC2::EIP
    Properties:
      Domain: vpc  

  # NAT Gateway in Public Subnet 2A
  natSubnetA:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId:
        Fn::GetAtt: [eipSubnetA, AllocationId]
      SubnetId:
        Ref: PRODSubnetPublic2a
      Tags:
        - Key: Name
          Value: nat-Subnet-a
  # Route through NAT Gateway
  NATRoute:
      Type: AWS::EC2::Route
      Properties:
        RouteTableId:
          Ref: PRODRTPrivate
        DestinationCidrBlock: 0.0.0.0/0
        GatewayId:
          Ref: natSubnetA 

我在 CloudFormation 事件选项卡中看到的错误是:

The following resource(s) failed to create: [NATRoute]. . Rollback requested by user

Route did not stabilize in expected time

不确定我错过了什么?

# Private Subnets to Route Table Association      
  PrivateSubnetA:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      SubnetId:
        Ref: PRODSubnetPrivate2a
      RouteTableId:
        Ref: PRODRTPrivate
  PrivateSubnetB:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      SubnetId:
        Ref: PRODSubnetPrivate2b
      RouteTableId:
        Ref: PRODRTPrivate      
  # Punblic Elastic IP for NAT Gateway in Zone 2A
  eipSubnetA:
    Type: AWS::EC2::EIP
    Properties:
      Domain: vpc 
  # NAT Gateway in Public Subnet 2A
  natSubnetA:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId:
        Fn::GetAtt: [eipSubnetA, AllocationId]
      SubnetId:
        Ref: PRODSubnetPublic2a
      Tags:
        - Key: Name
          Value: nat-Subnet-a
  # Route through NAT Gateway
  NATRoute:
      Type: AWS::EC2::Route
      Properties:
        RouteTableId:
          Ref: PRODRTPrivate
        DestinationCidrBlock: 0.0.0.0/0
        GatewayId:
          Ref: natSubnetA 

我希望私有路由表应该有目的地 0.0.0.0/0 的路由 NATGateway

【问题讨论】:

  • 其他资源都创建成功了吗?请记住,您的 cloudformation 模板可能需要添加 DependsOn 属性的资源创建的逻辑顺序,您可以这样做,资源依赖于其他资源的创建。例如,首先您需要在创建 NATRoute 之前创建 natSubnetA 资源

标签: amazon-cloudformation


【解决方案1】:

我发现了我犯的错误,通过将 GatewayId: 替换为 NatGatewayId: 解决了它:

【讨论】:

  • 为我节省了一天!正在做同样的事情。
猜你喜欢
  • 2022-01-11
  • 2020-07-14
  • 2018-10-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-04
  • 2017-05-22
  • 1970-01-01
相关资源
最近更新 更多