簡體   English   中英

Cloudformation - 路由表與網關有沖突的關聯

[英]Cloudformation - Route table has a conflicting association with the gateway

我正在嘗試使用 cloudformation 部署 EC2 實例,當我嘗試執行堆棧時出現以下錯誤。

路由表與網關 igw-0d7bbb47c8b4e8875 有沖突關聯(服務:AmazonEC2;狀態代碼:400;錯誤代碼:RouteConflict;請求 ID:0ca161d0-b58d-4f95-a2f1-01038ccc4cae;代理:null)

Parameters:
  InstanceType:
    Type: "String"
    Default: t2.micro
  Image:
    Type: "String"
    Default: ami-0aab712d6363da7f9

Resources:
  WebServer:
    Type: AWS::EC2::Instance
    Properties:
      AvailabilityZone: ap-southeast-2a
      KeyName: poweruser-keypair
      InstanceType: !Ref InstanceType
      ImageId: !Ref Image
      SubnetId: !Ref SubNet
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: "10.0.0.0/16"
      InstanceTenancy: default

  SubNet:
    Type: AWS::EC2::Subnet
    Properties:
      AvailabilityZone: ap-southeast-2a
      MapPublicIpOnLaunch: true
      CidrBlock: "10.0.0.0/24"
      VpcId: !Ref VPC

  InternetGateway:
    Type: AWS::EC2::InternetGateway

  IgwAttachment:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      InternetGatewayId: !Ref InternetGateway
      VpcId: !Ref VPC

  RouteTable:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId: !Ref VPC

  RoutingToInternet:
    Type: AWS::EC2::Route
    DependsOn: IgwAttachment
    Properties:
       RouteTableId: !Ref RouteTable
       DestinationCidrBlock: 0.0.0.0/0
       GatewayId: !Ref InternetGateway

  SubnetRouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref RouteTable
      SubnetId: !Ref SubNet

  SubnetNetworkAclAssociation:
    Type: AWS::EC2::SubnetNetworkAclAssociation
    Properties:
      SubnetId:
        Ref: SubNet
      NetworkAclId:
        Ref: NetworkACL

  NetworkACL:
    Type: AWS::EC2::NetworkAcl
    Properties:
      VpcId: !Ref VPC

  NACLEntry:
    Type: AWS::EC2::NetworkAclEntry
    Properties:
      CidrBlock: "10.0.0.0/16"
      Egress: true
      NetworkAclId: !Ref NetworkACL
      Protocol: -1
      RuleAction: "allow"
      RuleNumber: 100

您的 cloudformation 模板沒有任何問題 這意味着您在問題中使用的代碼不能完全代表您使用的實際模板。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM