路由未在预期时间内稳定 以下资源无法创建 NATRoute 。用户请求回滚

Box*_*oxy 4 aws-cloudformation

我正在尝试创建 CloudFormation Stack,它将创建 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 
Run Code Online (Sandbox Code Playgroud)

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

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

Route did not stabilize in expected time
Run Code Online (Sandbox Code Playgroud)

不确定我错过了什么?

# 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 
Run Code Online (Sandbox Code Playgroud)

我预计私有路由表应该有目的地 0.0.0.0/0 的路由 NATGateway

Box*_*oxy 13

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

  • 为我挽救了这一天!也在做同样的事情。 (2认同)