在使用 CloudFormation 创建 EC2 实例以及自动缩放组时,我遇到错误:
以下资源无法创建:[WebsInstanceServerGroup]。
image of CloudFormation Group output
创建自动伸缩组时出现失败,但是当我检查自动伸缩组控制台时,它说创建“成功”。 (“进行中”删除发生在 CloudFormation 15 分钟超时值之后)。
CloudFormation 未确认 AutoScale 组已成功创建的原因可能是什么?
该错误还说明了有关 WebInstanceServerGroup
的信息,因此我检查了我的模板,但没有发现任何可疑之处。
"WebsInstanceServerGroup": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones": {
"Fn::GetAZs": "AWS::Region"
},
"VPCZoneIdentifier": {
"Ref": "WebsELBSubnetId"
},
"LoadBalancerNames": [
{
"Ref": "WebsELB"
}
],
"LaunchConfigurationName": {
"Ref": "WebsEC2Instance"
},
"Cooldown": 300,
"HealthCheckGracePeriod": 600,
"HealthCheckType": "EC2",
"Tags": [
{
"Key": "Name",
"Value": {
"Ref": "WebsInstanceName"
},
"PropagateAtLaunch": "true"
},
{
"Key": "Service",
"Value": {
"Ref": "ServiceTag"
},
"PropagateAtLaunch": "true"
}
],
"MinSize": {
"Ref": "ASGMin"
},
"DesiredCapacity": {
"Ref": "ASGDesired"
},
"MaxSize": {
"Ref": "ASGMax"
}
},
"CreationPolicy": {
"ResourceSignal": {
"Count": {
"Ref": "ASGMin"
},
"Timeout": "PT15M"
}
}
}
如果需要更多信息,请告诉我,提前致谢。
最佳答案
您的自动扩展组中的 EC2 实例似乎没有发送 the required success signals .
CloudFormation 将等待您发送 ASGMin
信号,然后才考虑您的 WebsInstanceServerGroup
是否已成功创建。因此,如果 ASGMin
设置为 3,则 3 个 EC2 实例中的每一个都应发送一个信号。
要发送信号,您可以使用 cfn-signal
助手,或with the AWS CLI:
aws cloudformation signal-resource \
--stack-name {your stack name here} \
--status SUCCESS \
--logical-resource-id WebsInstanceServerGroup \
--unique-id {the instance ID for the EC2 instance that is sending the signal}
在 User Data 的末尾使用此命令当您认为您的 EC2 实例已完全配置并准备就绪时,请编写脚本。
关于amazon-web-services - AWS Cloudformation 无法确认 AutoScalingGroup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42893876/