【以下的问题经过翻译处理】 问题
使用 Elastic Beanstalk 与 GitHub Actions 部署应用程序,当Github Actions被触发时,Beanstalk 会创建一个 ASG,其中所需的容量会创建至少 1 个容器化应用程序实例。
由于某种原因,Beanstalk 提供的 ASG 几乎立即将实例设置为不健康并终止它们。这个过程重复 5 或 6 次,然后将错误状态返回给 beanstalk 应用程序。
ASG 仍处于配置状态,当我查看 ASG 活动历史记录日志时,我得到以下信息:
状态 | 说明 | 原因 |
---|
Cancelled | Launching a new EC2 instance. Status Reason: Instance Became unhealthy while waiting for instance to be in inService state. Termination Reason: Client.InternalError: Client error on launch | At 2022-01-13 an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 1 |
EB 环境事件抛出 4 个错误:
Creating Auto Scaling group named: awseb-[...]-AWSEBAutoScalingGroup-1V0R8Z9EJ8G8J failed. Reason: Group did not stabilize. {current/minSize/maxSize} group size = {0/1/1}.
Service:AmazonCloudFormation, Message:Stack named 'awseb-e-rvjtnttttf-immutable-stack' aborted operation. Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBAutoScalingGroup].
Failed to deploy application.
Cannot complete command execution on the following instances as they are no longer running: [i-03449eff8756123c2].
目前已采取以下步骤
- 检查IAM 角色权限以允许创建 EC2 实例
- 检查SG、负载均衡器与目标组之间的网络连接
个人观点
问题似乎不直接出在 Beanstalk 上,而是出在目标组和实例之间,也许需要 VPC Endpoint 才能让目标组健康检查通过?