AWS Systems Manager
API Reference (API Version 2014-11-06)

RegisterTaskWithMaintenanceWindow

Adds a new task to a Maintenance Window.

Request Syntax

{ "ClientToken": "string", "Description": "string", "LoggingInfo": { "S3BucketName": "string", "S3KeyPrefix": "string", "S3Region": "string" }, "MaxConcurrency": "string", "MaxErrors": "string", "Name": "string", "Priority": number, "ServiceRoleArn": "string", "Targets": [ { "Key": "string", "Values": [ "string" ] } ], "TaskArn": "string", "TaskInvocationParameters": { "Automation": { "DocumentVersion": "string", "Parameters": { "string" : [ "string" ] } }, "Lambda": { "ClientContext": "string", "Payload": blob, "Qualifier": "string" }, "RunCommand": { "Comment": "string", "DocumentHash": "string", "DocumentHashType": "string", "NotificationConfig": { "NotificationArn": "string", "NotificationEvents": [ "string" ], "NotificationType": "string" }, "OutputS3BucketName": "string", "OutputS3KeyPrefix": "string", "Parameters": { "string" : [ "string" ] }, "ServiceRoleArn": "string", "TimeoutSeconds": number }, "StepFunctions": { "Input": "string", "Name": "string" } }, "TaskParameters": { "string" : { "Values": [ "string" ] } }, "TaskType": "string", "WindowId": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ClientToken

User-provided idempotency token.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Required: No

Description

An optional description for the task.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Required: No

LoggingInfo

A structure containing information about an Amazon S3 bucket to write instance-level logs to.

Note

LoggingInfo has been deprecated. To specify an S3 bucket to contain logs, instead use the OutputS3BucketName and OutputS3KeyPrefix options in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported Maintenance Window task types, see MaintenanceWindowTaskInvocationParameters.

Type: LoggingInfo object

Required: No

MaxConcurrency

The maximum number of targets this task can be run for in parallel.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 7.

Pattern: ^([1-9][0-9]*|[1-9][0-9]%|[1-9]%|100%)$

Required: Yes

MaxErrors

The maximum number of errors allowed before this task stops being scheduled.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 7.

Pattern: ^([1-9][0-9]*|[0]|[1-9][0-9]%|[0-9]%|100%)$

Required: Yes

Name

An optional name for the task.

Type: String

Length Constraints: Minimum length of 3. Maximum length of 128.

Pattern: ^[a-zA-Z0-9_\-.]{3,128}$

Required: No

Priority

The priority of the task in the Maintenance Window, the lower the number the higher the priority. Tasks in a Maintenance Window are scheduled in priority order with tasks that have the same priority scheduled in parallel.

Type: Integer

Valid Range: Minimum value of 0.

Required: No

ServiceRoleArn

The role to assume when running the Maintenance Window task.

If you do not specify a service role ARN, Systems Manager will use your account's service-linked role for Systems Manager by default. If no service-linked role for Systems Manager exists in your account, it will be created when you run RegisterTaskWithMaintenanceWindow without specifying a service role ARN.

For more information, see Service-Linked Role Permissions for Systems Manager and Should I Use a Service-Linked Role or a Custom Service Role to Run Maintenance Window Tasks? in the AWS Systems Manager User Guide.

Type: String

Required: No

Targets

The targets (either instances or Maintenance Window targets).

Specify instances using the following format:

Key=InstanceIds,Values=<instance-id-1>,<instance-id-2>

Specify Maintenance Window targets using the following format:

Key=<WindowTargetIds>,Values=<window-target-id-1>,<window-target-id-2>

Type: Array of Target objects

Array Members: Minimum number of 0 items. Maximum number of 5 items.

Required: Yes

TaskArn

The ARN of the task to execute

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Required: Yes

TaskInvocationParameters

The parameters that the task should use during execution. Populate only the fields that match the task type. All other fields should be empty.

Type: MaintenanceWindowTaskInvocationParameters object

Required: No

TaskParameters

The parameters that should be passed to the task when it is executed.

Note

TaskParameters has been deprecated. To specify parameters to pass to a task when it runs, instead use the Parameters option in the TaskInvocationParameters structure. For information about how Systems Manager handles these options for the supported Maintenance Window task types, see MaintenanceWindowTaskInvocationParameters.

Type: String to MaintenanceWindowTaskParameterValueExpression object map

Key Length Constraints: Minimum length of 1. Maximum length of 255.

Required: No

TaskType

The type of task being registered.

Type: String

Valid Values: RUN_COMMAND | AUTOMATION | STEP_FUNCTIONS | LAMBDA

Required: Yes

WindowId

The ID of the Maintenance Window the task should be added to.

Type: String

Length Constraints: Fixed length of 20.

Pattern: ^mw-[0-9a-f]{17}$

Required: Yes

Response Syntax

{ "WindowTaskId": "string" }

Response Elements

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

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

WindowTaskId

The id of the task in the Maintenance Window.

Type: String

Length Constraints: Fixed length of 36.

Pattern: ^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$

Errors

For information about the errors that are common to all actions, see Common Errors.

DoesNotExistException

Error returned when the ID specified for a resource, such as a Maintenance Window or Patch baseline, doesn't exist.

For information about resource limits in Systems Manager, see AWS Systems Manager Limits.

HTTP Status Code: 400

FeatureNotAvailableException

You attempted to register a LAMBDA or STEP_FUNCTION task in a region where the corresponding service is not available.

HTTP Status Code: 400

IdempotentParameterMismatch

Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token.

HTTP Status Code: 400

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

ResourceLimitExceededException

Error returned when the caller has exceeded the default resource limits. For example, too many Maintenance Windows or Patch baselines have been created.

For information about resource limits in Systems Manager, see AWS Systems Manager Limits.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: