Queries instance Resource Access Management (RAM) roles that are attached to one or more instances.
Description
When you call an API operation by using Alibaba Cloud CLI, you must specify request parameter values of different data types in required formats. For more information, see Parameter format overview.
Debugging
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | DescribeInstanceRamRole | The operation that you want to perform. Set the value to DescribeInstanceRamRole. |
| PageNumber | Integer | No | 1 | The number of the page to return. Pages start from page 1. Default value: 1. |
| PageSize | Integer | No | 10 | The number of entries to return on each page. Maximum value: 50. Default value: 10. |
| RegionId | String | Yes | cn-hangzhou | The region ID of the instance RAM role. You can call the DescribeRegions operation to query the most recent list of regions. |
| InstanceIds | String | No | ["i-bp67acfmxazb1p****", "i-bp67acfmxazb2p****", "bp67acfmxazb3p****"…] | The IDs of instances. You can specify up to 100 instance IDs in a single request. You must specify at least one of the |
| RamRoleName | String | No | EcsServiceRole-EcsDocGuideTest | The name of the instance RAM role. You can call the ListRoles operation provided by RAM to query the instance RAM roles that you created. You must specify at least one of the |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | The ID of the request. |
| TotalCount | Integer | 1 | The total number of instance RAM roles returned. |
| RegionId | String | cn-hangzhou | The region ID of the instance RAM role. |
| InstanceRamRoleSets | Array of InstanceRamRoleSet | Details about the instance RAM roles. | |
| InstanceRamRoleSet | |||
| RamRoleName | String | EcsServiceRole-EcsDocGuideTest | The name of the instance RAM role. |
| InstanceId | String | i-bp67acfmxazb4p**** | The ID of the instance |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DescribeInstanceRamRole
&RegionId=cn-hangzhou
&InstanceIds=["i-bp67acfmxazb1p****", "i-bp67acfmxazb2p****", "bp67acfmxazb3p****"]
&PageNumber=1
&PageSize=1
&<Common request parameters>Sample success response
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeInstanceRamRoleResponse>
<RequestId>8F4CAE3F-7892-4662-83A5-2C2FFD639553</RequestId>
<InstanceRamRoleSets>
<InstanceRamRoleSet>
<InstanceId>i-bp67acfmxazb4p****</InstanceId>
<RamRoleName>EcsServiceRole-EcsDocGuideTest</RamRoleName>
</InstanceRamRoleSet>
</InstanceRamRoleSets>
<TotalCount>1</TotalCount>
<PageNumber>1</PageNumber>
<PageSize>1</PageSize>
</DescribeInstanceRamRoleResponse>JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "8F4CAE3F-7892-4662-83A5-2C2FFD639553",
"InstanceRamRoleSets" : {
"InstanceRamRoleSet" : [ {
"InstanceId" : "i-bp67acfmxazb4p****",
"RamRoleName" : "EcsServiceRole-EcsDocGuideTest"
} ]
},
"TotalCount" : 1,
"PageNumber" : 1,
"PageSize" : 1
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidInstanceIds.Malformed | The specified instanceIds are not valid. | The error message returned because the specified InstanceIds parameter is invalid. |
| 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. |
| 403 | InvalidNetworkType.MismatchRamRole | Ram role cannot be applied to instances of Classic network type. | The error message returned because instance RAM roles can be used only for instances in virtual private clouds (VPCs), not for instances in the classic network. |
| 403 | InvalidParameter.AllEmpty | %s | The error message returned because the required parameters are not specified. |
| 404 | InvalidInstanceId.NotFound | The specified instanceId does not exist | The error message returned because the specified instance does not exist. Check whether the instance ID is correct. |
For a list of error codes, see Service error codes.