- Documentation
Elastic Compute Service
Elastic Compute Service
API Reference
Instances
DescribeInstancesIamRoles - Queries IAM roles associated with instances
Instances
DescribeInstancesIamRoles - Queries IAM roles associated with instances
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.
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
Sample response
Error codes
The table below lists the business-related error codes of the operation. For more information, refer to Common error codes.
Last updated: 2026.06.18 17:48:24