AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::SSM::MaintenanceWindowTask

CfnMaintenanceWindowTask

The `AWS::SSM::MaintenanceWindowTask` resource defines information about a task for an AWS Systems Manager maintenance window. For more information, see [RegisterTaskWithMaintenanceWindow](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_RegisterTaskWithMaintenanceWindow.html) in the *AWS Systems Manager API Reference* .

Import

import { CfnMaintenanceWindowTask } from 'aws-cdk-lib/aws-ssm';

Or use the module namespace:

import * as ssm from 'aws-cdk-lib/aws-ssm';
// ssm.CfnMaintenanceWindowTask

Properties

Configuration passed to the constructor as CfnMaintenanceWindowTaskProps.

priorityRequired
number

The priority of the task in the maintenance window. The lower the number, the higher the priority. Tasks that have the same priority are scheduled in parallel.

taskArnRequired
string

The resource that the task uses during execution. For `RUN_COMMAND` and `AUTOMATION` task types, `TaskArn` is the SSM document name or Amazon Resource Name (ARN). For `LAMBDA` tasks, `TaskArn` is the function name or ARN. For `STEP_FUNCTIONS` tasks, `TaskArn` is the state machine ARN.

taskTypeRequired
string

The type of task. Valid values: `RUN_COMMAND` , `AUTOMATION` , `LAMBDA` , `STEP_FUNCTIONS` .

windowIdRequired
string

The ID of the maintenance window where the task is registered.

cutoffBehaviorOptional
string

The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.

descriptionOptional
string

A description of the task.

loggingInfoOptional
IResolvable | LoggingInfoProperty

> `LoggingInfo` has been deprecated. To specify an Amazon S3 bucket to contain logs for Run Command tasks, 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 [AWS ::SSM::MaintenanceWindowTask MaintenanceWindowRunCommandParameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-maintenancewindowtask-maintenancewindowruncommandparameters.html) . Information about an Amazon S3 bucket to write Run Command task-level logs to.

maxConcurrencyOptional
string

The maximum number of targets this task can be run for, in parallel. > Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a [targetless task](https://docs.aws.amazon.com/systems-manager/latest/userguide/maintenance-windows-targetless-tasks.html) You must provide a value in all other cases. > > For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of `1` . This value doesn't affect the running of your task.

maxErrorsOptional
string

The maximum number of errors allowed before this task stops being scheduled. > Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a [targetless task](https://docs.aws.amazon.com/systems-manager/latest/userguide/maintenance-windows-targetless-tasks.html) You must provide a value in all other cases. > > For maintenance window tasks without a target specified, you can't supply a value for this option. Instead, the system inserts a placeholder value of `1` . This value doesn't affect the running of your task.

nameOptional
string

The task name.

serviceRoleArnOptional
string

The Amazon Resource Name (ARN) of the IAM service role for AWS Systems Manager to assume when running a maintenance window task. If you do not specify a service role ARN, Systems Manager uses a service-linked role in your account. If no appropriate service-linked role for Systems Manager exists in your account, it is created when you run `RegisterTaskWithMaintenanceWindow` . However, for an improved security posture, we strongly recommend creating a custom policy and custom service role for running your maintenance window tasks. The policy can be crafted to provide only the permissions needed for your particular maintenance window tasks. For more information, see [Setting up Maintenance Windows](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-maintenance-permissions.html) in the in the *AWS Systems Manager User Guide* .

targetsOptional
IResolvable | IResolvable | TargetProperty[]

The targets, either instances or window target IDs. - Specify instances using `Key=InstanceIds,Values= *instanceid1* , *instanceid2*` . - Specify window target IDs using `Key=WindowTargetIds,Values= *window-target-id-1* , *window-target-id-2*` .

taskInvocationParametersOptional
IResolvable | TaskInvocationParametersProperty

The parameters to pass to the task when it runs. Populate only the fields that match the task type. All other fields should be empty. > When you update a maintenance window task that has options specified in `TaskInvocationParameters` , you must provide again all the `TaskInvocationParameters` values that you want to retain. The values you do not specify again are removed. For example, suppose that when you registered a Run Command task, you specified `TaskInvocationParameters` values for `Comment` , `NotificationConfig` , and `OutputS3BucketName` . If you update the maintenance window task and specify only a different `OutputS3BucketName` value, the values for `Comment` and `NotificationConfig` are removed.

taskParametersOptional
any

> `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](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_MaintenanceWindowTaskInvocationParameters.html) . The parameters to pass to the task when it runs.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter