0 votes
1 view
in AWS by (18.2k points)

We are trying to get the state of a registered target (instance) in a target group. This can be done with the command aws elbv2 describe-target-health --target-group-arn ${TG} --targets Id=${ID},Port=${PORT}, reference. We are able to get the PORT via the aws ecs describe-tasks --cluster $CLUSTER --tasks $task command, reference. But how can the target's instance Id be retrieved via CLI?

1 Answer

0 votes
by (42.4k points)

This will give you the array of registered instance ID in a target group. When you have target ARN why you using target ID? so I am skipping target ID and using just target ARN.

aws elbv2 describe-target-health --target-group-arn ${TG}  --query 'TargetHealthDescriptions[*].Target.Id'

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...