내용으로 건너뛰기

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

질문됨 한 달 전43회 조회
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

답변함 한 달 전
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠