スキップしてコンテンツを表示

delay the termination of a new server

0

Hi, I have an elasticbeanstalk environment with Corretto 17 with an java app. When aws implements weekly platform update with the immutable deployment policy enabled. aws then launching one instance and the app is deployed into this instance. AWS will then verify health.If something is wrong, eg: failed to deploy configuration the aws will terminate new instances and temporary Auto Scaling group. As the new instance was terminated just after some minutes and no update, I could not access to the new instance to check why the app is broken. I download the log data but could not find something useful. Do you know how to keep the new instance for a while so I can ssh to it to check. thanks

質問済み 1ヶ月前44ビュー
1回答
0

To delay the termination of the new instance during an Elastic Beanstalk immutable deployment, you can configure instance retention using EC2 Auto Scaling's instance lifecycle policy feature. This will allow you to keep the instance available for troubleshooting even when the deployment fails.

Here's how to set this up:

Configure Instance Lifecycle Policy:

You'll need to modify the Auto Scaling group that Elastic Beanstalk creates during the immutable deployment. Set up an instance lifecycle policy with retention triggers that will keep instances when termination lifecycle hooks are abandoned or timeout.

  1. Add a termination lifecycle hook to the Auto Scaling group with:
  • Lifecycle transition: "autoscaling:EC2_INSTANCE_TERMINATING"
  • Default result: "ABANDON"
  • A heartbeat timeout (e.g., 300 seconds)
  1. Configure the instance lifecycle policy to retain instances when the termination hook is abandoned. This is done by setting the retention trigger to "TerminateHookAbandon" with an action of "retain."

When the deployment fails and AWS attempts to terminate the new instance, the lifecycle hook will trigger. If it times out or is abandoned, the instance will be retained in a "retained" state rather than being immediately terminated. This gives you time to SSH into the instance and investigate the deployment failure.

You can later manually terminate the instance once you've completed your troubleshooting. Note that this feature is available in specific regions including US East (N. Virginia), US West (Oregon), Europe (Ireland), and Asia Pacific (Singapore).
Sources
EC2 Auto Scaling introduces instance lifecycle policy - AWS
Configure instance retention - Amazon EC2 Auto Scaling

回答済み 1ヶ月前
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ