Is there a way to describe a Security Group in a specific 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
A security group is like a virtual firewall. It works much like a traditional firewall does. It consists of a set of rules that can be used to monitor and filter an instance's incoming and outgoing traffic in a Virtual Private Cloud (VPC) instance. Filtering is done on the basis of protocols and ports.
Which statement best describes security groups? They are stateful and deny all inbound traffic by default.
When you launch an instance in a VPC, you must specify a security group that's created for that VPC. After you launch an instance, you can change its security groups. Security groups are associated with network interfaces.
To describe all security groups in a given VPC:
aws ec2 describe-security-groups --filters "Name=vpc-id,Values=vpc-abcd1234"
To describe a specific security group by its ID:
aws ec2 describe-security-groups --group-id sg-1234abcd
To describe a specific security group by its name (for non-default VPCs):
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):
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With