Menu
AWS Identity and Access Management
API Reference (API Version 2010-05-08)

GetRole

Retrieves information about the specified role, including the role's path, GUID, ARN, and the role's trust policy that grants permission to assume the role. For more information about roles, see Working with Roles.

Note

Policies returned by this API are URL-encoded compliant with RFC 3986. You can use a URL decoding method to convert the policy back to plain JSON text. For example, if you use Java, you can use the decode method of the java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs provide similar functionality.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

RoleName

The name of the IAM role to get information about.

This parameter allows (per its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [\w+=,.@-]+

Required: Yes

Response Elements

The following element is returned by the service.

Role

A structure containing details about the IAM role.

Type: Role object

Errors

For information about the errors that are common to all actions, see Common Errors.

NoSuchEntity

The request was rejected because it referenced an entity that does not exist. The error message describes the entity.

HTTP Status Code: 404

ServiceFailure

The request processing has failed because of an unknown error, exception or failure.

HTTP Status Code: 500

Example

Sample Request

Copy
https://iam.amazonaws.com/?Action=GetRole &RoleName=S3Access &Version=2010-05-08 &AUTHPARAMS

Sample Response

Copy
<GetRoleResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/"> <GetRoleResult> <Role> <Path>/application_abc/component_xyz/</Path> <Arn>arn:aws:iam::123456789012:role/application_abc/component_xyz/S3Access</Arn> <RoleName>S3Access</RoleName> <AssumeRolePolicyDocument> {"Version":"2012-10-17","Statement":[{"Effect":"Allow", "Principal":{"Service":["ec2.amazonaws.com"]},"Action":["sts:AssumeRole"]}]} </AssumeRolePolicyDocument> <CreateDate>2012-05-08T23:34:01Z</CreateDate> <RoleId>AROADBQP57FF2AEXAMPLE</RoleId> </Role> </GetRoleResult> <ResponseMetadata> <RequestId>df37e965-9967-11e1-a4c3-270EXAMPLE04</RequestId> </ResponseMetadata> </GetRoleResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: