All Products
Search
Document Center

Resource Management:GetRole

Last Updated:Aug 31, 2026

Queries the information about a role by calling GetRole.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

RoleName

string

Yes

The role name.

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

ECSAdmin

Language

string

No

The language type. The role description is returned in the specified language. Valid values:

  • en: English.

  • zh-CN: Chinese.

  • ja: Japanese.

zh-CN

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

04F0F334-1335-436C-A1D7-6C044FE73368

Role

object

The role information.

Arn

string

The resource descriptor of the role.

acs:ram::123456789012****:role/ECSAdmin

AssumeRolePolicyDocument

string

The content of the access policy that specifies the trusted entity to assume the role.

{ \"Statement\": [ { \"Action\": \"sts:AssumeRole\", \"Effect\": \"Allow\", \"Principal\": { \"RAM\": \"acs:ram::12345678901234****:root\" } } ], \"Version\": \"1\" }

CreateDate

string

The time when the role was created. The time is in RFC 3339 UTC format, indicated by Z.

2015-01-23T12:33:18Z

Description

string

The description of the role.

ECS management role

IsServiceLinkedRole

boolean

Indicates whether the role is a service-linked role.

true

LatestDeletionTask

object

The information about the most recent deletion task.

CreateDate

string

The time when the deletion task was created. The time is in RFC 3339 UTC format, indicated by Z.

2018-10-23T12:33:18Z

DeletionTaskId

string

The ID of the deletion task.

ECSAdmin/cc61514b-26eb-4453-ab53-b142eb702a3d

MaxSessionDuration

integer

The maximum session duration of the role.

3600

RoleId

string

The role ID.

90123456789****

RoleName

string

The role name.

ECSAdmin

RolePrincipalName

string

The name of the authorized role.

ECSAdmin@role.123456.onaliyunservice.com

UpdateDate

string

The time when the role was last updated. The time is in RFC 3339 UTC format, indicated by Z.

2016-01-23T12:33:18Z

Examples

Success response

JSON format

{
  "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  "Role": {
    "Arn": "acs:ram::123456789012****:role/ECSAdmin",
    "AssumeRolePolicyDocument": "{ \\\"Statement\\\": [ { \\\"Action\\\": \\\"sts:AssumeRole\\\", \\\"Effect\\\": \\\"Allow\\\", \\\"Principal\\\": { \\\"RAM\\\": \\\"acs:ram::12345678901234****:root\\\" } } ], \\\"Version\\\": \\\"1\\\" }",
    "CreateDate": "2015-01-23T12:33:18Z",
    "Description": "ECS administrator",
    "IsServiceLinkedRole": true,
    "LatestDeletionTask": {
      "CreateDate": "2018-10-23T12:33:18Z",
      "DeletionTaskId": "ECSAdmin/cc61514b-26eb-4453-ab53-b142eb702a3d"
    },
    "MaxSessionDuration": 3600,
    "RoleId": "90123456789****",
    "RoleName": "ECSAdmin",
    "RolePrincipalName": "ECSAdmin@role.123456.onaliyunservice.com",
    "UpdateDate": "2016-01-23T12:33:18Z"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.RoleName.InvalidChars The specified role name contains invalid characters. The specified role name contains invalid characters.
400 InvalidParameter.RoleName.Length The maximum length of the role name is exceeded. The maximum length of the role name is exceeded.
404 EntityNotExist.Role The role does not exist. The role does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.