You can call this operation to delete a security group.
Description
Before you delete a security group, make sure that no instances exist in the security group and that the security group is not referenced by other security groups (DescribeSecurityGroupReferences). Otherwise, the DeleteSecurityGroup request fails.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeleteSecurityGroup |
The operation that you want to perform. Set the value to DeleteSecurityGroup. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region. You can call the DescribeRegions operation to query the most recent region list. |
SecurityGroupId | String | Yes | sg-bp1fg655nh68xyz9**** |
The ID of the security group. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DeleteSecurityGroup
&RegionId=cn-hangzhou
&SecurityGroupId=sg-bp1fg655nh68xyz9****
&<Common request parameters>
Sample success responses
XML
format
<DeleteSecurityGroupResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeleteSecurityGroupResponse>
JSON
format
{
"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
403 | DependencyViolation | There is still instance(s) in the specified security group. | The error message returned because instances exist in the security group. Release the instances and try again. |
403 | DependencyViolation | The specified security group has been authorized in another one. | The error message returned because the specified security group is referenced by another security group. |
500 | InternalError | The request processing has failed due to some unknown error. | The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket. |
For a list of error codes, visit the API Error Center.