gpt4 book ai didi

amazon-web-services - 如何在 `aws-cli ec2` 命令中使用通配符?

转载 作者:行者123 更新时间:2023-12-01 12:38:05 25 4
gpt4 key购买 nike

我有一些 EC2 实例。我想用ec2 describe-instances命令根据标签的特定值获取实例列表。

该表显示了我的用例。

Instance  | Value (key:Purpose)     | Outcome
----------+-------------------------+------------
InstanceA | Going | Filter
InstanceB | Shopping,Going | Filter
InstanceC | Going,Shoping | Filter
InstanceD | Shopping,Going,Chatting | Filter
InstanceE | GoingGreat | DONT Filter
InstanceF | NotGoing | DONT Filter

所以我想以某种方式在 ec2-describe-instances 命令中使用通配符,以便获得预期的结果。

最佳答案

以下是如何过滤 ec2-describe-instances 的输出的示例基于标签的值:

aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId]' --filters "Name=platform,Values=windows" --output text

此示例显示了所有 EC2 实例的实例 ID,其中“platform”标签设置为“windows”的值。

Values 参数中也允许使用通配符(例如 Name=platform,Values=win* )。

关于amazon-web-services - 如何在 `aws-cli ec2` 命令中使用通配符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27719831/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com