简体   繁体   English

Cloudformation - 路由表与网关有冲突的关联

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

I'm trying to deploy EC2 instance using cloudformation, It's giving the following error when i try to execute the stack.我正在尝试使用 cloudformation 部署 EC2 实例,当我尝试执行堆栈时出现以下错误。

Route table has a conflicting association with the gateway igw-0d7bbb47c8b4e8875 (Service: AmazonEC2; Status Code: 400; Error Code: RouteConflict; Request ID: 0ca161d0-b58d-4f95-a2f1-01038ccc4cae; Proxy: null)路由表与网关 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

There is nothing wrong with your cloudformation template.您的 cloudformation 模板没有任何问题 This means that the code that you used in the question is not fully representative of your actual template that you use.这意味着您在问题中使用的代码不能完全代表您使用的实际模板。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Terraform AWS - 路由表关联 - 添加多个 su.net - Terraform AWS - route table association - add multiple subnet 如何在Terraform中的route_table_association中引用多个su.net? - How to take the reference of multiple subnets in route_table_association in Terraform? Cloudformation 参数 map 并使用 !join 加入 API 网关 uri - Cloudformation Parameter map and using !join to join API Gateway uri 如何在 VPC 中创建中转网关附件到另一个账户中创建的中转网关(使用 Cloudformation) - How to create a transi gateway attachement in a VPC to a transit gateway created in another account (with Cloudformation) AWS Cloudformation - 将 VPC_Link / NLB 附加到 api 网关中的方法给出“无效方法设置路径”错误 - AWS Cloudformation - Attach VPC_Link / NLB to method in api gateway gives "Invalid method setting path" error 为 AWS websocket API 网关使用自定义域时出现证书错误(使用 CloudFormation) - Certificate errors when using a custom domain for an AWS websocket API Gateway (using CloudFormation) AWS Cloudformation Lambda + API 网关 V2:无法部署 API,因为此 API 中不存在路由 - AWS Cloudformation Lambda + API Gateway V2: Unable to deploy API because no routes exist in this API AWS API 网关 REST API 是否没有设置禁用 CloudFormation 模板中的 execute-api 端点? - Is there no setting for AWS API Gateway REST API to disable execute-api endpoint in CloudFormation template? AWS - 从公共 API 网关路由到 VPC 内 lambda - AWS - Route from public API Gateway to in-VPC lambda 如何在Cloudformation模板中引用DynamoDB表的最新Stream - How to reference the latest Stream of a DynamoDB table in a Cloudformation template
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM