我想了解aws ec2 cli调用。我期待描述所有VPC然后在自定义标签文件管理器(vpcname = myvpc,但是试图多种组合我不断收到冲突的有关格式和使用--filters的错误。使用作为参考后[ http://docs.aws .amazon.com / cli / latest / reference / ec2 / describe-vpcs.html] [1]
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 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
所以尝试其他几种组合
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
关于如何格式化此请求的任何建议?
您几乎可以解决它-唯一的问题是您没有为describe-vpcs指定有效的过滤器。以下是与您的用例相关的过滤器:
tag:key=*value* - The key/value combination of a tag assigned to the resource.
因此,当它要求时Name=string1,Values=string1...
,它期望:
改用此方法,可以使用其他自定义标签在本地为我工作:
aws ec2 describe-vpcs --filters Name=tag:vpcname,Values=myvpc
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句