Elastic Beanstalk - EB_IS_COMMAND_LEADER during instance replacement

0

For Elastic Beanstalk environments, the environmental variable EB_IS_COMMAND_LEADER is available in platform hooks so that leader detection is possible and scripts can be gated to prevent execution on non-leader instances.

When an instance replacement is in process, however, (for example, during a managed update where the underlying instance is to be fully replaced), EB_IS_COMMAND_LEADER returns false on all new instances during deployment inside the platform hooks. If an instance replacement is not in process, EB_IS_COMMAND_LEADER appears to function predictably.

What is the correct way to ensure a platform hook is executed on a leader instance, even if an instance replacement is occurring?

Thanks!

已提問 2 年前檢視次數 1153 次
1 個回答
0
已接受的答案

Hello,

Leader-only container commands are only executed during environment creation and deployments, while other commands and server customization operations are performed every time an instance is provisioned or updated. This same behavior is seen for platform hooks. During updates that cause instance replacements such as managed updates, the leader_only:true flag is not set and this is the expected default behavior.

Currently, the workaround is to perform a new deployment after the instance replacements/managed update so that a new leader is elected.

There is an existing feature request for this functionality and I have added a comment on your behalf. There is a similar feature request on our GitHub roadmap and I encourage you to engage the service team on the roadmap page as well.

While I am unable to comment on if/when this feature may get released, I request you to keep an eye on our What's New and Blog pages for any new feature announcements.

AWS
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南