

# GetServiceRoleForAccount
<a name="API_GetServiceRoleForAccount"></a>

Gets the service role associated with Amazon IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region. Amazon IoT Greengrass uses this role to verify the identity of client devices and manage core device connectivity information. For more information, see [Greengrass service role](https://docs.amazonaws.cn/greengrass/v2/developerguide/greengrass-service-role.html) in the * Amazon IoT Greengrass Version 2 Developer Guide*.

## Request Syntax
<a name="API_GetServiceRoleForAccount_RequestSyntax"></a>

```
GET /greengrass/servicerole HTTP/1.1
```

## URI Request Parameters
<a name="API_GetServiceRoleForAccount_RequestParameters"></a>

The request does not use any URI parameters.

## Request Body
<a name="API_GetServiceRoleForAccount_RequestBody"></a>

The request does not have a request body.

## Response Syntax
<a name="API_GetServiceRoleForAccount_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "AssociatedAt": "string",
   "RoleArn": "string"
}
```

## Response Elements
<a name="API_GetServiceRoleForAccount_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [AssociatedAt](#API_GetServiceRoleForAccount_ResponseSyntax) **   <a name="greengrassv2-GetServiceRoleForAccount-response-AssociatedAt"></a>
The time when the service role was associated with Amazon IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.  
Type: String

 ** [RoleArn](#API_GetServiceRoleForAccount_ResponseSyntax) **   <a name="greengrassv2-GetServiceRoleForAccount-response-RoleArn"></a>
The ARN of the service role that is associated with Amazon IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.  
Type: String

## Errors
<a name="API_GetServiceRoleForAccount_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InternalServerException **   
 Amazon IoT Greengrass can't process your request right now. Try again later.    
 ** retryAfterSeconds **   
The amount of time to wait before you retry the request.
HTTP Status Code: 500

## See Also
<a name="API_GetServiceRoleForAccount_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for C\+\+](https://docs.amazonaws.cn/goto/SdkForCpp/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/greengrassv2-2020-11-30/GetServiceRoleForAccount) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/greengrassv2-2020-11-30/GetServiceRoleForAccount) 