You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Instances
DescribeInstancesIamRoles - Queries IAM roles associated with instances
Copy page
Download PDF
DescribeInstancesIamRoles - Queries IAM roles associated with instances
Call the DescribeInstancesIamRoles operation to query the IAM roles that are associated with one or more ECS instances.​
Debugging​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
The table below lists only the request parameters specific to this operation and some common parameters. For more information, refer to Common parameters.​
Action string required Sample value: DescribeInstancesIamRoles​
The operation that you want to perform. Valid value: DescribeInstancesIamRoles.​
​
Version string required Sample value: 2020-04-01​
The version of the API. Valid value: 2020-04-01.​
​
InstanceIds.N string[] Optional Sample value: InstanceIds.1=i-cm9tn4z1eohuu4d3****&InstanceIds.2=i-3tiegs1y963vj0****​
The instance ID. A maximum of 100 instance IDs are supported.​
  • Parameter - N: specifies the serial number of the instance.​
  • Multiple instance IDs are separated by &.​
​
MaxResults integer Optional Sample value: 10​
The number of rows per page when you set up a pagination query.​
  • Maximum value: 100​
  • Default value: 10​
​
NextToken string Optional Sample value: --​
Pagination token marking the query position. Omit this parameter for initial API requests. In the next query, set the NextToken parameter to the value returned by the previous API call.​
​
​
​
Response parameters​
Only the response parameters specific to this operation are listed below. For more information, refer to the response structure.​
InstancesIamRoles object[] Sample value: --​
The collection of IAM roles that meet the conditions.​
InstanceId string Sample value: i-3thhlu8byl4bwbha****​
The instance ID.​
​
RoleNames string[] Sample value: ["EcsTestRole"]​
The name of the IAM role associated with the instance.​
​
​
NextToken string Sample value: bHpwdXJja2RxemU1eG5sb3NzdGcW1-RCEq******​
The query credentials value returned by this call. If null is returned, this page is the last page.​
​
​
​
Sample request​
​
GET /?Action=DescribeInstancesIamRoles&Version=2020-04-01&InstanceIds.1=i-cm9tn4z1eohuu4d3**** HTTP/1.1​
Host: ecs.cn-beijing.volcengineapi.com​
Region: cn-beijing​
Service: ecs​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "2021110417394001022514606307******",​
"Action": "DescribeInstancesIamRoles",​
"Version": "2020-04-01",​
"Service": "ecs",​
"Region": "cn-beijing"​
},​
"Result": {​
"InstancesIamRoles": [​
{​
"InstanceId": "i-cm9tn4z1eohuu4d3****",​
"RoleNames": [​
"EcsTestRole"​
]​
}​
],​
"NextToken": ""​
}​
}​
​
Error codes​
The table below lists the business-related error codes of the operation. For more information, refer to Common error codes.​
​
Status code​
Error code​
Error message​
Description​
400​
InvalidArgument​
The specified argument is invalid.​
The specified parameter is invalid.​
400​
LimitExceeded.MaximumInstanceIds​
You've reached the limit on the number of InstanceIds that you can set.​
The specified number of InstanceIds exceeds the maximum limit.​
429​
FlowLimitExceeded​
You've reached the limit on request rate of resources.​
You have exceeded the rate limit for resource requests.​
500​
InternalError​
An internal error has occurred.​
An internal error occurred. Try again. If multiple attempts fail, submit a ticket.​
​
​
Last updated: 2026.06.18 17:48:24