[英]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.