如何以逗号分隔列表的形式获取附加到ELB的实例的列表 [英] How to get list of instances attached to ELB in form of comma separated list

查看:89
本文介绍了如何以逗号分隔列表的形式获取附加到ELB的实例的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取附加到ELB的所有实例的列表(需要在进一步处理中使用它们).

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"

但是,上面的命令给了我JSON格式的列表.

However, above command gives me the list in JSON format.

[
    [
        "i-05676776d8cd4ab5344b0d",
"i-05676776"
    ]
]

我该怎么办?

谢谢!

推荐答案

-输出文本并将其通过管道传递到 paste

--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

这篇关于如何以逗号分隔列表的形式获取附加到ELB的实例的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆