AssociateServiceRoleToAccountCommand

Associates a Greengrass service role with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region. IoT Greengrass uses this role to verify the identity of client devices and manage core device connectivity information. The role must include the AWSGreengrassResourceAccessRolePolicy  managed policy or a custom policy that defines equivalent permissions for the IoT Greengrass features that you use. For more information, see Greengrass service role  in the IoT Greengrass Version 2 Developer Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { GreengrassV2Client, AssociateServiceRoleToAccountCommand } from "@aws-sdk/client-greengrassv2"; // ES Modules import
// const { GreengrassV2Client, AssociateServiceRoleToAccountCommand } = require("@aws-sdk/client-greengrassv2"); // CommonJS import
const client = new GreengrassV2Client(config);
const input = { // AssociateServiceRoleToAccountRequest
  roleArn: "STRING_VALUE", // required
};
const command = new AssociateServiceRoleToAccountCommand(input);
const response = await client.send(command);
// { // AssociateServiceRoleToAccountResponse
//   associatedAt: "STRING_VALUE",
// };

AssociateServiceRoleToAccountCommand Input

Parameter
Type
Description
roleArn
Required
string | undefined

The Amazon Resource Name (ARN) of the service role to associate with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.

AssociateServiceRoleToAccountCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
associatedAt
string | undefined

The time when the service role was associated with IoT Greengrass for your Amazon Web Services account in this Amazon Web Services Region.

Throws

Name
Fault
Details
InternalServerException
server

IoT Greengrass can't process your request right now. Try again later.

ValidationException
client

The request isn't valid. This can occur if your request contains malformed JSON or unsupported characters.

GreengrassV2ServiceException
Base exception class for all service exceptions from GreengrassV2 service.