什么是在描述-VPCS标签的正确语法过滤? [英] What is the correct syntax for filtering by tag in describe-vpcs?

查看:199
本文介绍了什么是在描述-VPCS标签的正确语法过滤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解AWS EC2 CLI调用。我期待来形容的自定义标签(vpcname = myvpc所有VPC那么文件管理器,但尝试多种组合,我不断收到有关格式和使用--filters相互矛盾的误差之后,使用作为参考[ http://docs.aws.amazon.com/cli/latest/引用/ EC2 /描述-vpcs.html] [1]

I am trying to understand a aws ec2 cli call. I am looking to describe all VPC then filer on a custom tag (vpcname=myvpc, however after trying multiple combinations I keep getting conflicting errors about the format and use of --filters. using as a reference [http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html][1]

AWS --profile我的资料--region欧盟 - 西1 EC2描述,VPCS --filters   vpcname,myvpc

aws --profile myProfile --region eu-west-1 ec2 describe-vpcs --filters vpcname,myvpc

然而,这将返回

Error parsing parameter '--filters': should be: Key value pairs, where values are separated by commas, and multiple pairs are separated by spaces.
--filters Name=string1,Values=string1,string2 Name=string1,Values=string1,string2

所以想

AWS --profile我的资料--region欧盟 - 西1 EC2描述,VPCS --filters   名称= vpcname,值= myvpc

aws --profile myProfile --region eu-west-1 ec2 describe-vpcs --filters Name=vpcname,Values=myvpc

和返回

A client error (InvalidParameterValue) occurred when calling the DescribeVpcs operation: The filter 'vpcname' is invalid

所以尝试一些其他组合

so trying a few other combinations

aws --profile myProfile --region eu-west-1 ec2 describe-vpcs --filters tag :Name=vpcname,Values=myvpc

Error parsing parameter '--filters': should be: Key value pairs, where values are separated by commas, and multiple pairs are separated by spaces.
--filters Name=string1,Values=string1,string2 Name=string1,Values=string1,string2

我如何格式化这个请求任何意见?

Any advice on how I format this request?

推荐答案

您有pretty的接近解决它 - 唯一的问题是,你是不是指定的valid过滤器描述,VPCS 。这里的过滤器,这将是有关你的使用情况:

You got pretty close to solving it -- the only problem is that you are not specifying a valid filter for describe-vpcs. Here's the filter that would be relevant to your use case:

tag:key=*value* - The key/value combination of a tag assigned to the resource.

因此​​,当它被要求名称=字符串1,值=字符串1 ... ,它预计:

  • 名称=标签:标签名
  • 值= TagValue

试试这个,而不是在当地工作对我来说具有不同的自定义标签:

Try this instead, works for me locally with a different custom tag:

aws ec2 describe-vpcs --filters Name=tag:vpcname,Values=myvpc

这篇关于什么是在描述-VPCS标签的正确语法过滤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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