You can invoke DescribeSecurityGroupAttribute to query the security group rules of a security group.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ens:DescribeSecurityGroupAttribute |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SecurityGroupId |
string |
Yes |
The ID of the security group. |
sg-bp67acfmxazb4ph*** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| Description |
string |
The description of the security group. |
testDescription1 |
| SecurityGroupId |
string |
The ID of the destination security group. |
sg-bp1gxw6bznjjvhu3**** |
| SecurityGroupName |
string |
The name of the destination security group. |
testSecurityGroupName2 |
| Permissions |
object |
||
| Permission |
array<object> |
Details about the rules. |
|
|
object |
Schema of Response |
||
| CreationTime |
string |
The time at which the security group rule was created. The time is displayed in UTC. |
2018-12-12T07:28:38Z |
| Direction |
string |
The direction in which the security group rule is applied. |
ingress |
| Policy |
string |
The policy. |
Accept |
| PortRange |
string |
The source port range. |
80/80 |
| SourceCidrIp |
string |
The range of source IP addresses for inbound access control. |
0.0.0.0/0 |
| IpProtocol |
string |
The transport layer protocol. |
TCP |
| DestCidrIp |
string |
The range of destination IP addresses for outbound access control. |
0.0.0.0/0 |
| Priority |
integer |
The priority of the rule. |
1 |
| SourcePortRange |
string |
The source port number range for the security group. |
22/22 |
| Description |
string |
The description. |
testDescription1 |
| Ipv6SourceCidrIp |
string |
The source IPv6 CIDR block. |
::/0 |
| Ipv6DestCidrIp |
string |
The destination IPv6 CIDR block. |
::/0 |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"Description": "testDescription1",
"SecurityGroupId": "sg-bp1gxw6bznjjvhu3****",
"SecurityGroupName": "testSecurityGroupName2",
"Permissions": {
"Permission": [
{
"CreationTime": "2018-12-12T07:28:38Z",
"Direction": "ingress",
"Policy": "Accept",
"PortRange": "80/80",
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "TCP",
"DestCidrIp": "0.0.0.0/0",
"Priority": 1,
"SourcePortRange": "22/22",
"Description": "testDescription1",
"Ipv6SourceCidrIp": "::/0",
"Ipv6DestCidrIp": "::/0"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | NoPermission | Permission denied. | |
| 400 | InvalidSecurityGroupId.NotFound | The specified SecurityGroupId does not exist. | The specified security group ID does not exist. |
| 400 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | The current operation is not supported. The disk is being reset. |
| 400 | CallInterface | Call Interface Happen Error. | An error occurred when you call the operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.