问题
I want to get list of all instances attached to an ELB (need to use them in further processing).
Here is what I have done so far :
aws elb describe-load-balancers --load-balancer-name 'my-elb' --output json --query "LoadBalancerDescriptions[*].Instances[*].InstanceId"
However, above command gives me the list in JSON format.
[
[
"i-05676776d8cd4ab5344b0d",
"i-05676776"
]
]
How can I do?
Thanks!
回答1:
--output text
and pipe it to paste
aws elb describe-load-balancers --load-balancer-name 'my-elb' --output text --query "LoadBalancerDescriptions[*].Instances[*].InstanceId" | paste -d, -s
来源:https://stackoverflow.com/questions/42706884/how-to-get-list-of-instances-attached-to-elb-in-form-of-comma-separated-list