AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the DescribeSecurityGroups operation. Describes the specified security groups or all of your security groups.
A security group is for use with instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 security groups in the Amazon Elastic Compute Cloud User Guide and Security groups for your VPC in the Amazon Virtual Private Cloud User Guide.
We are retiring EC2-Classic. We recommend that you migrate from EC2-Classic to a VPC. For more information, see Migrate from EC2-Classic to a VPC in the Amazon Elastic Compute Cloud User Guide.
Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z
public class DescribeSecurityGroupsRequest : AmazonEC2Request IAmazonWebServiceRequest
The DescribeSecurityGroupsRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
DescribeSecurityGroupsRequest() |
Name | Type | Description | |
---|---|---|---|
![]() |
Filters | System.Collections.Generic.List<Amazon.EC2.Model.Filter> |
Gets and sets the property Filters. The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.
|
![]() |
GroupIds | System.Collections.Generic.List<System.String> |
Gets and sets the property GroupIds. The IDs of the security groups. Required for security groups in a nondefault VPC. Default: Describes all of your security groups. |
![]() |
GroupNames | System.Collections.Generic.List<System.String> |
Gets and sets the property GroupNames.
[EC2-Classic and default VPC only] The names of the security groups. You can specify
either the security group name or the security group ID. For security groups in a
nondefault VPC, use the Default: Describes all of your security groups. |
![]() |
MaxResults | System.Int32 |
Gets and sets the property MaxResults. The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. This value can be between 5 and 1000. If this parameter is not specified, then all items are returned. For more information, see Pagination. |
![]() |
NextToken | System.String |
Gets and sets the property NextToken. The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request. |
This example describes the specified security group.
var client = new AmazonEC2Client(); var response = client.DescribeSecurityGroups(new DescribeSecurityGroupsRequest { GroupIds = new List<string> { "sg-903004f8" } });
This example describes the security groups that include the specified tag (Purpose=test).
var client = new AmazonEC2Client(); var response = client.DescribeSecurityGroups(new DescribeSecurityGroupsRequest { Filters = new List<Filter> { new Filter { Name = "tag:Purpose", Values = new List<string> { "test" } } } });
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5