Deletes a RAM role.


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 DeleteRole

The operation that you want to perform. Set the value to DeleteRole.

RoleName String Yes ECSAdmin

The name of the RAM role.

The name must be 1 to 64 characters in length and can contain letters, digits, periods (.), and hyphens (-).

Response parameters

Parameter Type Example Description
RequestId String 898FAB24-7509-43EE-A287-086FE4C44394

The ID of the request.


Sample requests
&<Common request parameters>

Sample success responses

XML format

       <RequestId type="string">898FAB24-7509-43EE-A287-086FE4C44394</RequestId>

JSON format

    "RequestId": "898FAB24-7509-43EE-A287-086FE4C44394"

Error codes

HTTP status code Error code Error message Description
400 InvalidParameter.RoleName.InvalidChars The specified role name contains invalid characters. The error message returned because the RAM role name contains invalid characters.
400 InvalidParameter.RoleName.Length The maximum length of the role name is exceeded. The error message returned because the length of the RAM role name has exceeded the upper limit.
404 EntityNotExist.Role The role does not exist. The error message returned because the RAM role does not exist.
409 DeleteConflict.Role.Policy The role cannot have any attached policies when you delete it. The error message returned because the RAM role has attached policies and you cannot delete it. Detach the policies from the RAM role first.

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