createActivation method
Generates an activation code and activation ID you can use to register your on-premises server or virtual machine (VM) with Systems Manager. Registering these machines with Systems Manager makes it possible to manage them using Systems Manager capabilities. You use the activation code and ID when installing SSM Agent on machines in your hybrid environment. For more information about requirements for managing on-premises instances and VMs using Systems Manager, see Setting up AWS Systems Manager for hybrid environments in the AWS Systems Manager User Guide.
May throw InternalServerError.
Parameter iamRole
:
The Amazon Identity and Access Management (IAM) role that you want to
assign to the managed instance. This IAM role must provide AssumeRole
permissions for the Systems Manager service principal
ssm.amazonaws.com
. For more information, see Create
an IAM service role for a hybrid environment in the AWS Systems
Manager User Guide.
Parameter defaultInstanceName
:
The name of the registered, managed instance as it will appear in the
Systems Manager console or when you use the AWS command line tools to list
Systems Manager resources.
Parameter description
:
A user-defined description of the resource that you want to register with
Systems Manager.
Parameter expirationDate
:
The date by which this activation request should expire. The default value
is 24 hours.
Parameter registrationLimit
:
Specify the maximum number of managed instances you want to register. The
default value is 1 instance.
Parameter tags
:
Optional metadata that you assign to a resource. Tags enable you to
categorize a resource in different ways, such as by purpose, owner, or
environment. For example, you might want to tag an activation to identify
which servers or virtual machines (VMs) in your on-premises environment
you intend to activate. In this case, you could specify the following key
name/value pairs:
-
Key=OS,Value=Windows
-
Key=Environment,Value=Production
Implementation
Future<CreateActivationResult> createActivation({
required String iamRole,
String? defaultInstanceName,
String? description,
DateTime? expirationDate,
int? registrationLimit,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(iamRole, 'iamRole');
_s.validateStringLength(
'iamRole',
iamRole,
0,
64,
isRequired: true,
);
_s.validateStringLength(
'defaultInstanceName',
defaultInstanceName,
0,
256,
);
_s.validateStringLength(
'description',
description,
0,
256,
);
_s.validateNumRange(
'registrationLimit',
registrationLimit,
1,
1000,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.CreateActivation'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'IamRole': iamRole,
if (defaultInstanceName != null)
'DefaultInstanceName': defaultInstanceName,
if (description != null) 'Description': description,
if (expirationDate != null)
'ExpirationDate': unixTimestampToJson(expirationDate),
if (registrationLimit != null) 'RegistrationLimit': registrationLimit,
if (tags != null) 'Tags': tags,
},
);
return CreateActivationResult.fromJson(jsonResponse.body);
}