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!

asked 2 years ago1129 views
1 Answer
0
Accepted Answer

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
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions