How to pause the awscli running until a target de-registered completely
We can automate the target de-registration process using the awscli commands. It will take some time to pull the target out after de-registering it from target groups.
awscli provides an option to pause the further steps until a target is de-registered completely.
#aws elbv2 wait target-deregistered --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…