Correct aws cli syntax to find default VPC security group in VPC

This is a question about What is the correct syntax for filtering by tag in description-vpcs? .

Using the provided answer and link 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.

I built a cli request

aws --profile myProfile --region eu-west-1 ec2 describe-security-groups --group-name MyVpcSecGroup --filters Name=tag:vpc-id,Values=vpc-9xxxxxxx

however i get an error

Security group 'MyVpcSecGroup' does not exist in VPC by default 'VPC-bxxxxxx

So, how do I format the syntax for finding a security group in a non-default VPC using a list of -filters such as vpc-id?

thanks Art

+2
source share
2

:

   --group-names (list)
      [EC2-Classic, default VPC] One or more security group names.

, , --group-names VPC .

:

aws ec2 describe-security-groups --group-ids sg-xxxxxxxx
aws ec2 describe-security-groups --filters Name=group-name,Values=MyVpcSecGroup

VPC Name:

aws ec2 describe-security-groups --filters Name=vpc-id,Values=vpc-11223344 Name=group-name,Values=MyVpcSecGroup

VPC :

aws ec2 describe-security-groups --filters Name=vpc-id,Values=vpc-11223344 Name=tag-value,Values=Production

VPC :

aws ec2 describe-security-groups --filters Name=vpc-id,Values=vpc-11223344 Name=tag:Environment,Values=Production

. .

+5

:

aws --profile myProfile ec2 describe-security-groups --region=AWS_REGION --filters "Name=vpc-id,Values=VPC_ID" --filters "Name=group-name,Values=NAMEOFSECGROUP"
+2

All Articles