Deletes a security group.


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.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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.


Sample requests
&<Common request parameters>

Sample success responses

XML format


JSON format


Error codes

HttpCode 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. Remove 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 error persists, submit a ticket.
403 InvalidOperation.ResourceManagedByCloudProduct %s The error message returned because the security groups managed by cloud services cannot be modified.

For a list of error codes, visit the API Error Center.