amazon-web-services - AWS Cloudformation 无法确认 AutoScalingGroup

标签 amazon-web-services amazon-ec2 autoscaling aws-cloudformation

在使用 CloudFormation 创建 EC2 实例以及自动缩放组时,我遇到错误: 以下资源无法创建:[WebsInstanceServerGroup]。

image of CloudFormation Group output

创建自动伸缩组时出现失败,但是当我检查自动伸缩组控制台时,它说创建“成功”。 (“进行中”删除发生在 CloudFormation 15 分钟超时值之后)。

image of AutoScaling output

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/

相关文章:

amazon-web-services - S3 : User cannot access object in his own s3 bucket if created by another user

php - 亚马逊 EC2 :- Not able to downgrade PHP version from 7. 4 到 7.2

Azure 自动缩放 block 找不到证书

kubernetes - GKE 集群自动扩缩程序与托管实例组中的自动扩缩程序

amazon-web-services - 如何将软件包(例如 libjpeg-dev)自动加载到我的 Elastic Beanstalk 应用程序?

amazon-web-services - Amazon Redshift 中的列式数据库查询

amazon-web-services - 将 Elastic Beanstalk 上的平台从 PHP 更改为 Node.js

amazon-ec2 - 如何在同一实例上更改 AMI

amazon-web-services - 将安全组的参数化列表添加到另一个安全组入口

containers - Fargate 向上扩展始终如一,但向下扩展并不始终如一