DescribeSecurityGroups

Last Updated: Mar 28, 2018

Description

Describes the basic information about your security groups, such as the security group ID and description. We return and display your security groups in a descending order by the security group ID.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: DescribeSecurityGroups.
RegionId String Yes The ID of the region to which the security groups belong. For more information, see Regions and zones, or call DescribeRegions to obtain the latest region list.
VpcId String No The ID of the VPC to which the security groups belong.
Tag.n.Key String No The tag key of security groups. The valid range of n is [1, 5].
Once you use this parameter, it cannot be a null string.
Tag.n.Value String No The tag value of security groups. The valid range of n is [1, 5].
Once you use this parameter, it can be a null string.
PageNumber Integer No Displays the security groups on several pages.
Start value: 1.
Default value: 1.
PageSize Integer No The maximum entries on a page.
Maximum value: 50.
Default value: 10.

Response parameters

Name Type Description
TotalCount Integer The total number of security groups.
PageNumber Integer The current page.
PageSize Integer The number of entries on each page.
RegionId String The region ID.
SecurityGroups SecurityGroupItemType The security group information, composed by a SecurityGroupItemType collection.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=DescribeSecurityGroups
  2. &RegionId=cn-hangzhou
  3. &<Common Request Parameters>

Response example

XML format

  1. <DescribeSecurityGroupsResponse>
  2. <RequestId>94D38899-626D-434A-891F-7E1F77A81525</RequestId>
  3. <TotalCount>4</TotalCount>
  4. <PageNumber>1</PageNumber>
  5. <PageSize>10</PageSize>
  6. <RegionId>cn-hangzhou</RegionId>
  7. <SecurityGroups>
  8. <SecurityGroup>
  9. <SecurityGroupId>sg-F876FF7BA</SecurityGroupId>
  10. <Description>Test</Description>
  11. </SecurityGroup>
  12. <SecurityGroup>
  13. <SecurityGroupId>sg-086FFC27A</SecurityGroupId>
  14. <Description>test00212</Description>
  15. </SecurityGroup>
  16. <SecurityGroup>
  17. <SecurityGroupId>sg-BA4B7975B</SecurityGroupId>
  18. <Description>cn-hangzhou test group</Description>
  19. </SecurityGroup>
  20. <SecurityGroup>
  21. <SecurityGroupId>sg-35F20777C</SecurityGroupId>
  22. <Description>cn-hangzhou test group</Description>
  23. </SecurityGroup>
  24. </SecurityGroups>
  25. </DescribeSecurityGroupsResponse>

JSON format

  1. {
  2. "RequestId": "94D38899-626D-434A-891F-7E1F77A81525",
  3. "TotalCount": 4,
  4. "PageSize": "10",
  5. "RegionId": "cn-hangzhou",
  6. "PageNumber": "1",
  7. "SecurityGroups": {
  8. "SecurityGroup": [{
  9. "SecurityGroupId": "sg-F876FF7BA",
  10. "Description": "TestByXcf"
  11. },
  12. {
  13. "SecurityGroupId": "sg-086FFC27A",
  14. "Description": "test00212"
  15. },
  16. {
  17. "SecurityGroupId": "sg-BA4B7975B",
  18. "Description": "cn-hangzhou test group"
  19. },
  20. {
  21. "SecurityGroupId": "sg-35F20777C",
  22. "Description": "cn-hangzhou test group"
  23. }]
  24. }
  25. }

Error codes

All are common error codes. For more information, see Common error codes.

Thank you! We've received your feedback.