AWS --Cloudformation --SubnetRouteTableAssociation - 无法及时稳定

时间:2018-03-08 17:05:33

标签: amazon-web-services amazon-cloudformation amazon-vpc

我有一个堆栈一直在向下构建,但由于原因我似乎无法弄清楚它开始在一个奇怪的位置打破导致CREATE_FAILED错误。
  有问题的错误代码: AWS :: EC2 :: SubnetRouteTableAssociation SubnetRouteTableAssociationMain子网路由表关联rtbassoc-894281e2无法在预期时间内稳定
  现在我发现这非常有趣,因为我在构建的早期阶段与此子网协会有类似的错误,但它有时会工作,有时会失败。以下是有问题的代码库以及可能与此设置冲突的任何其他内容,似乎失败的是倒数第二个代码块。

SocoDrIGW:
    Type: AWS::EC2::InternetGateway
    Properties: 
        Tags:
        - 
            Key: SOCODR
            Value: InternetGateway


RouteTableSocoDrMain:
    Type: AWS::EC2::RouteTable
    DependsOn: SocoDrVPC
    Properties:
                VpcId: 
                    Ref: SocoDrVPC

RouteDrMain:
    Type: AWS::EC2::Route
    DependsOn:
            - RouteTableSocoDrMain
            - SocoDrIGW
            - SocoDrSubnet01
    Properties:
        RouteTableId: 
            Ref: RouteTableSocoDrMain
        DestinationCidrBlock: 0.0.0.0/0
        GatewayId: 
            Ref: SocoDrIGW

#ERROR OCCURS HERE
SubnetRouteTableAssociationMain:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
                SubnetId:
                        Ref: SocoDrSubnet01
                RouteTableId:
                        Ref: RouteTableSocoDrMain

SocoDrSubnet01:
    Type: AWS::EC2::Subnet
    Properties:
        AvailabilityZone: !Join [ '', [ !Ref 'AWS::Region', !Ref AvailabilityZones ] ]
        VpcId: 
                Ref: SocoDrVPC
        CidrBlock: 10.10.8.0/24

        Tags:
        - 
            Key: SOCODR
            Value: Subnet

1 个答案:

答案 0 :(得分:1)

I figured out what was wrong with it though. According to the white pages:您的VPC中的每个子网都必须与路由表相关联;该表控制子网的路由。子网一次只能与一个路由表关联,但您可以将多个子网与相同的路由表关联
  我配置的是两个子网路由表关联相互取消,因为它们都连接到同一个子网。