updateManagedInstanceRole method

Future<void> updateManagedInstanceRole({
  1. required String iamRole,
  2. required String instanceId,
})

Changes the Identity and Access Management (IAM) role that is assigned to the on-premises server, edge device, or virtual machines (VM). IAM roles are first assigned to these hybrid nodes during the activation process. For more information, see CreateActivation.

May throw InternalServerError. May throw InvalidInstanceId.

Parameter iamRole : The name of the Identity and Access Management (IAM) role that you want to assign to the managed node. This IAM role must provide AssumeRole permissions for the Amazon Web Services Systems Manager service principal ssm.amazonaws.com. For more information, see Create the IAM service role required for Systems Manager in hybrid and multicloud environments in the Amazon Web Services Systems Manager User Guide.

Parameter instanceId : The ID of the managed node where you want to update the role.

Implementation

Future<void> updateManagedInstanceRole({
  required String iamRole,
  required String instanceId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.UpdateManagedInstanceRole'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'IamRole': iamRole,
      'InstanceId': instanceId,
    },
  );
}