CmdID

CmdID / aws / aws ec2

aws ec2 get-security-groups-for-vpc

Gets security groups that can be associated by the Amazon Web Services account making the request with network interfaces in the specified VPC. AWS CLI reference

1 example 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

To view security groups that can be associated with network interfaces in a specified VPC.

The following get-security-groups-for-vpc example shows the security groups that can be associated with network interfaces in the VPC.

aws ec2 get-security-groups-for-vpc --vpc-id vpc-6c31a611Identify
--vpc-idThe VPC ID where the security group can be used.
Its output
{
    "SecurityGroupForVpcs": [
        {
            "Description": "launch-wizard-36 created 2022-08-29T15:59:35.338Z",
            "GroupName": "launch-wizard-36",
            "OwnerId": "123456789012",
            "GroupId": "sg-007e0c3027ee885f5",
            "Tags": [],
            "PrimaryVpcId": "vpc-6c31a611"
        },
        {
            "Description": "launch-wizard-18 created 2024-01-19T20:22:27.527Z",
            "GroupName": "launch-wizard-18",
            "OwnerId": "123456789012",
            "GroupId": "sg-0147193bef51c9eef",
            "Tags": [],
            "PrimaryVpcId": "vpc-6c31a611"
        }
    ]
}

For more information, see Associate security groups with multiple VPCs in the Amazon VPC User Guide.

Options

5 in the AWS CLI reference
--dry-runChecks whether you have the required permissions for the action, without actually making the request, and provides an error response.
--filtersThe filters.
--max-resultsThe maximum number of items to return for this request.
--next-tokenThe token returned from a previous paginated request.
--vpc-idThe VPC ID where the security group can be used.