【发布时间】:2016-11-23 06:37:48
【问题描述】:
以下是我的带有 vpc、子网、安全组、启动配置和自动缩放的模板。
我能够创建 lauch 配置和自动缩放组,但我的自动缩放组不启动实例。
我面临VPC security groups may not be used for a non-VPC launch 错误。
{
"myvpc": {
"Type": "AWS: : EC2: : VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
"InstanceTenancy": "default"
}
},
"mySubnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "myvpc"
},
"CidrBlock": "10.0.1.0/24",
"AvailabilityZone": "us-east-1a",
"Tags": [
{
"Key": "mysubnet",
"Value": "mysubnet"
}
]
}
},
"ec2Security": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "my CloudFormation security group",
"VpcId": {
"Ref": "myvpc"
},
"SecurityGroupIngress": [
{
"IpProtocol": "-1",
"FromPort": "-1",
"ToPort": "-1",
"CidrIp": "0.0.0.0/0"
}
],
"SecurityGroupEgress": [
{
"IpProtocol": "-1",
"FromPort": "-1",
"ToPort": "-1",
"CidrIp": "0.0.0.0/0"
}
]
}
},
"WebServerGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones": [
{
"Fn::GetAtt": [
"mySubnet",
"AvailabilityZone"
]
}
],
"LaunchConfigurationName": {
"Ref": "WebServerLaunchConfig"
},
"MinSize": "1",
"MaxSize": "10",
"DesiredCapacity": {
"Ref": "DesiredInstances"
}
}
},
"WebServerLaunchConfig": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"ImageId": "ami-xxxxx",
"InstanceType": {
"Ref": "InstanceType"
},
"KeyName": "xxxxxxxx",
"SecurityGroups": [
{
"Ref": "ec2Security"
}
]
}
}
}
我想使用 Cloudformation 在 VPC 中的不同 az 启动多个实例。
我在这里做错了什么。
谢谢。
【问题讨论】: