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 IAM roles in the IAM User Guide.
Note
Policies returned by this operation are URL-encoded compliant
with RFC 3986decode
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 (through 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 a resource entity that does not exist. The error message describes the resource.
HTTP Status Code: 404
- ServiceFailure
-
The request processing has failed because of an unknown error, exception or failure.
HTTP Status Code: 500
Examples
Example
This example illustrates one usage of GetRole.
Sample Request
https://iam.amazonaws.com/?Action=GetRole
&RoleName=S3Access
&Version=2010-05-08
&AUTHPARAMS
Sample Response
<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>
<RoleLastUsed>
<LastUsedDate>2019-11-20T17:09:20Z</LastUsedDate>
<Region>us-east-1</Region>
</RoleLastUsed>
</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: