這是What is the correct syntax for filtering by tag in describe-vpcs?的後續問題。更正aws cli語法以在非默認VPC中查找VPC安全組
使用提供的答案和參考http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-security-groups.html
--filters (list)
One or more filters.
......
vpc-id - The ID of the VPC specified when the security group was created.
我已經構建了CLI請求
aws --profile myProfile --region eu-west-1 ec2 describe-security-groups --group-name MyVpcSecGroup --filters Name=tag:vpc-id,Values=vpc-9xxxxxxx
但是我得到一個錯誤
安全組 'MyVpcSecGroup' 不存在默認VPC 'vpc-bxxxxxx'
那麼如何格式化語法以在非默認VPC中使用--filters(如vpc-id)列表搜索安全組?
THX藝術
感謝@約翰,我的問題是不明確的,所以我增加了一些信息,以最後一句。我希望通過基於標記進行過濾來獲取MyVpcSecGroup信息,例如vpc-id。這應該返回ifo特定VPC的特定組ID。 Thx Art – 2014-11-25 12:42:56
已更新,其中包含通過Tag進行過濾的示例。 – 2014-11-25 23:44:48
完美@約翰,添加組名稱作爲過濾器是我失蹤,藝術 – 2014-11-26 03:03:31