简体   繁体   English

如何描述VPC的安全组?

[英]How to describe Security Groups for a VPC?

Is there a way to describe a Security Group in a specific VPC? 有没有办法在特定的VPC中描述安全组?

Here is what I am trying to run : 这是我想要运行的:

aws ec2 describe-security-groups --group-name "<group-name>" --filter Name=vpc-id,Values=<my-vpc-id>

But it is returning this error : 但是它返回了这个错误:

A client error (VPCIdNotSpecified) occurred when calling the DescribeSecurityGroups operation: No default VPC for this user

I appreciate your help, 我感谢您的帮助,

Thanks 谢谢

To describe all security groups in a given VPC: 要描述给定VPC中的所有安全组:

aws ec2 describe-security-groups --filters "Name=vpc-id,Values=vpc-abcd1234"

To describe a specific security group by its ID: 要按ID描述特定安全组:

aws ec2 describe-security-groups --group-id sg-1234abcd

To describe a specific security group by its name (for non-default VPCs): 要按名称描述特定安全组(对于非默认VPC):

aws ec2 describe-security-groups --filters Name=group-name,Values=MY-SG

To describe a specific security group by its name and VPC (since there can be multiple groups with the same name in different VPCS): 要按名称和VPC描述特定安全组(因为在不同的VPCS中可以有多个具有相同名称的组):

aws ec2 describe-security-groups --filters Name=group-name,Values=MY-SG Name=vpc-id,Values=vpc-abcd1234

See AWS Command-Line Interface (CLI) documentation: describe-security-groups 请参阅AWS命令行界面(CLI)文档: describe-security-groups

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM