【发布时间】:2017-07-15 05:40:59
【问题描述】:
我正在使用 CloudFormation 创建整个堆栈。我注意到,即使我的云形成模板中确实有 0.0.0.0/0 的路由规则来访问 Internet 网关,但它并没有被创建。
VPC:
"vpc": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "172.31.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"Tags": [
{
"Key": "Environment",
"Value": {
"Ref": "Env"
}
}
]
}
路由表:
"rtb": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "vpc"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "65297cdc-8bcd-482d-af40-b0fef849b8c2"
}
}
}
VPCGateway附件:
"gw1": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "vpc"
},
"InternetGatewayId": {
"Ref": "ig"
}
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "aa69d6c0-3b11-43be-a8c1-7e79176f8c89"
}
}
}
路线:
"route1": {
"Type": "AWS::EC2::Route",
"Properties": {
"DestinationCidrBlock": "0.0.0.0/0",
"RouteTableId": {
"Ref": "rtb"
},
"GatewayId": {
"Ref": "ig"
}
},
"DependsOn": "gw1",
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "a68dd12e-3c14-4fa9-ba36-e0046374a0e9"
}
}
}
互联网网关:
"ig": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "9f9b4ce3-b994-43ff-9155-04aeb7ab2edf"
}
}
}
正在创建所有项目,但 VPC 的 IG 路由规则除外。 cloudformation 堆栈创建没有错误。
路由表:
Destination: 172.31.0.0/16
Target: local
预期的路由表:
Destination: 172.31.0.0/16
Target: local
Destination: 0.0.0.0/0
Target: igw-********
请注意,我可以在创建 cloudformation 堆栈后直接自己添加规则。
我有什么遗漏吗?
【问题讨论】:
-
资源在我看来是正确的 - 请添加堆栈事件历史记录的完整输出(控制台中的
Events选项卡),以防出现异常情况。 -
我认为共享堆栈的整个输出有点不安全。我刚刚仔细检查过,没有错误或警告,都具有 CREATE_COMPLETE 的状态。首先创建
ig,然后创建vpc,然后创建rtb和gw1,最后创建route1。我认为这是一个错误。
标签: amazon-web-services amazon-cloudformation