How to pause the awscli running until a registered target is in service

We can automate the target registration process using the awscli commands. It will take some time to get the target in healthy state after registering it to target groups.

awscli provides an option to pause the further steps until a registered target is in service.

#aws elbv2 wait target-in-service --target-group-arn <TARGET-ARN> --targets Id=<TARGET-ID>,Port=<PORT>

Where,

<TARGET-ARN> need to be replaced with the ARN of the target group.
<TARGET-ID> need to be replaced with the id of the target instance.
<PORT> need to be replaced with the target port of the instance.

Please note that command will not produce any output.

That's all…

Leave a Reply