Skip to content
v2.277.0

CfnMaintenanceWindowTaskProps Struct ​

Properties for defining a CfnMaintenanceWindowTask.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ssm as ssm } from 'aws-cdk-lib';

declare const parameters: any;
declare const taskParameters: any;
const cfnMaintenanceWindowTaskProps: ssm.CfnMaintenanceWindowTaskProps = {
  priority: 123,
  taskArn: 'taskArn',
  taskType: 'taskType',
  windowId: 'windowId',

  // the properties below are optional
  cutoffBehavior: 'cutoffBehavior',
  description: 'description',
  loggingInfo: {
    region: 'region',
    s3Bucket: 's3Bucket',

    // the properties below are optional
    s3Prefix: 's3Prefix',
  },
  maxConcurrency: 'maxConcurrency',
  maxErrors: 'maxErrors',
  name: 'name',
  serviceRoleArn: 'serviceRoleArn',
  targets: [{
    key: 'key',
    values: ['values'],
  }],
  taskInvocationParameters: {
    maintenanceWindowAutomationParameters: {
      documentVersion: 'documentVersion',
      parameters: parameters,
    },
    maintenanceWindowLambdaParameters: {
      clientContext: 'clientContext',
      payload: 'payload',
      qualifier: 'qualifier',
    },
    maintenanceWindowRunCommandParameters: {
      cloudWatchOutputConfig: {
        cloudWatchLogGroupName: 'cloudWatchLogGroupName',
        cloudWatchOutputEnabled: false,
      },
      comment: 'comment',
      documentHash: 'documentHash',
      documentHashType: 'documentHashType',
      documentVersion: 'documentVersion',
      notificationConfig: {
        notificationArn: 'notificationArn',

        // the properties below are optional
        notificationEvents: ['notificationEvents'],
        notificationType: 'notificationType',
      },
      outputS3BucketName: 'outputS3BucketName',
      outputS3KeyPrefix: 'outputS3KeyPrefix',
      parameters: parameters,
      serviceRoleArn: 'serviceRoleArn',
      timeoutSeconds: 123,
    },
    maintenanceWindowStepFunctionsParameters: {
      input: 'input',
      name: 'name',
    },
  },
  taskParameters: taskParameters,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ssm as ssm

# parameters: Any
# task_parameters: Any

cfn_maintenance_window_task_props = ssm.CfnMaintenanceWindowTaskProps(
    priority=123,
    task_arn="taskArn",
    task_type="taskType",
    window_id="windowId",

    # the properties below are optional
    cutoff_behavior="cutoffBehavior",
    description="description",
    logging_info=ssm.CfnMaintenanceWindowTask.LoggingInfoProperty(
        region="region",
        s3_bucket="s3Bucket",

        # the properties below are optional
        s3_prefix="s3Prefix"
    ),
    max_concurrency="maxConcurrency",
    max_errors="maxErrors",
    name="name",
    service_role_arn="serviceRoleArn",
    targets=[ssm.CfnMaintenanceWindowTask.TargetProperty(
        key="key",
        values=["values"]
    )],
    task_invocation_parameters=ssm.CfnMaintenanceWindowTask.TaskInvocationParametersProperty(
        maintenance_window_automation_parameters=ssm.CfnMaintenanceWindowTask.MaintenanceWindowAutomationParametersProperty(
            document_version="documentVersion",
            parameters=parameters
        ),
        maintenance_window_lambda_parameters=ssm.CfnMaintenanceWindowTask.MaintenanceWindowLambdaParametersProperty(
            client_context="clientContext",
            payload="payload",
            qualifier="qualifier"
        ),
        maintenance_window_run_command_parameters=ssm.CfnMaintenanceWindowTask.MaintenanceWindowRunCommandParametersProperty(
            cloud_watch_output_config=ssm.CfnMaintenanceWindowTask.CloudWatchOutputConfigProperty(
                cloud_watch_log_group_name="cloudWatchLogGroupName",
                cloud_watch_output_enabled=False
            ),
            comment="comment",
            document_hash="documentHash",
            document_hash_type="documentHashType",
            document_version="documentVersion",
            notification_config=ssm.CfnMaintenanceWindowTask.NotificationConfigProperty(
                notification_arn="notificationArn",

                # the properties below are optional
                notification_events=["notificationEvents"],
                notification_type="notificationType"
            ),
            output_s3_bucket_name="outputS3BucketName",
            output_s3_key_prefix="outputS3KeyPrefix",
            parameters=parameters,
            service_role_arn="serviceRoleArn",
            timeout_seconds=123
        ),
        maintenance_window_step_functions_parameters=ssm.CfnMaintenanceWindowTask.MaintenanceWindowStepFunctionsParametersProperty(
            input="input",
            name="name"
        )
    ),
    task_parameters=task_parameters
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ssm.*;

Object parameters;
Object taskParameters;

CfnMaintenanceWindowTaskProps cfnMaintenanceWindowTaskProps = CfnMaintenanceWindowTaskProps.builder()
        .priority(123)
        .taskArn("taskArn")
        .taskType("taskType")
        .windowId("windowId")

        // the properties below are optional
        .cutoffBehavior("cutoffBehavior")
        .description("description")
        .loggingInfo(LoggingInfoProperty.builder()
                .region("region")
                .s3Bucket("s3Bucket")

                // the properties below are optional
                .s3Prefix("s3Prefix")
                .build())
        .maxConcurrency("maxConcurrency")
        .maxErrors("maxErrors")
        .name("name")
        .serviceRoleArn("serviceRoleArn")
        .targets(List.of(TargetProperty.builder()
                .key("key")
                .values(List.of("values"))
                .build()))
        .taskInvocationParameters(TaskInvocationParametersProperty.builder()
                .maintenanceWindowAutomationParameters(MaintenanceWindowAutomationParametersProperty.builder()
                        .documentVersion("documentVersion")
                        .parameters(parameters)
                        .build())
                .maintenanceWindowLambdaParameters(MaintenanceWindowLambdaParametersProperty.builder()
                        .clientContext("clientContext")
                        .payload("payload")
                        .qualifier("qualifier")
                        .build())
                .maintenanceWindowRunCommandParameters(MaintenanceWindowRunCommandParametersProperty.builder()
                        .cloudWatchOutputConfig(CloudWatchOutputConfigProperty.builder()
                                .cloudWatchLogGroupName("cloudWatchLogGroupName")
                                .cloudWatchOutputEnabled(false)
                                .build())
                        .comment("comment")
                        .documentHash("documentHash")
                        .documentHashType("documentHashType")
                        .documentVersion("documentVersion")
                        .notificationConfig(NotificationConfigProperty.builder()
                                .notificationArn("notificationArn")

                                // the properties below are optional
                                .notificationEvents(List.of("notificationEvents"))
                                .notificationType("notificationType")
                                .build())
                        .outputS3BucketName("outputS3BucketName")
                        .outputS3KeyPrefix("outputS3KeyPrefix")
                        .parameters(parameters)
                        .serviceRoleArn("serviceRoleArn")
                        .timeoutSeconds(123)
                        .build())
                .maintenanceWindowStepFunctionsParameters(MaintenanceWindowStepFunctionsParametersProperty.builder()
                        .input("input")
                        .name("name")
                        .build())
                .build())
        .taskParameters(taskParameters)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.SSM;

var parameters;
var taskParameters;

var cfnMaintenanceWindowTaskProps = new CfnMaintenanceWindowTaskProps {
    Priority = 123,
    TaskArn = "taskArn",
    TaskType = "taskType",
    WindowId = "windowId",

    // the properties below are optional
    CutoffBehavior = "cutoffBehavior",
    Description = "description",
    LoggingInfo = new LoggingInfoProperty {
        Region = "region",
        S3Bucket = "s3Bucket",

        // the properties below are optional
        S3Prefix = "s3Prefix"
    },
    MaxConcurrency = "maxConcurrency",
    MaxErrors = "maxErrors",
    Name = "name",
    ServiceRoleArn = "serviceRoleArn",
    Targets = new [] { new TargetProperty {
        Key = "key",
        Values = new [] { "values" }
    } },
    TaskInvocationParameters = new TaskInvocationParametersProperty {
        MaintenanceWindowAutomationParameters = new MaintenanceWindowAutomationParametersProperty {
            DocumentVersion = "documentVersion",
            Parameters = parameters
        },
        MaintenanceWindowLambdaParameters = new MaintenanceWindowLambdaParametersProperty {
            ClientContext = "clientContext",
            Payload = "payload",
            Qualifier = "qualifier"
        },
        MaintenanceWindowRunCommandParameters = new MaintenanceWindowRunCommandParametersProperty {
            CloudWatchOutputConfig = new CloudWatchOutputConfigProperty {
                CloudWatchLogGroupName = "cloudWatchLogGroupName",
                CloudWatchOutputEnabled = false
            },
            Comment = "comment",
            DocumentHash = "documentHash",
            DocumentHashType = "documentHashType",
            DocumentVersion = "documentVersion",
            NotificationConfig = new NotificationConfigProperty {
                NotificationArn = "notificationArn",

                // the properties below are optional
                NotificationEvents = new [] { "notificationEvents" },
                NotificationType = "notificationType"
            },
            OutputS3BucketName = "outputS3BucketName",
            OutputS3KeyPrefix = "outputS3KeyPrefix",
            Parameters = parameters,
            ServiceRoleArn = "serviceRoleArn",
            TimeoutSeconds = 123
        },
        MaintenanceWindowStepFunctionsParameters = new MaintenanceWindowStepFunctionsParametersProperty {
            Input = "input",
            Name = "name"
        }
    },
    TaskParameters = taskParameters
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var parameters interface{}
var taskParameters interface{}

cfnMaintenanceWindowTaskProps := &CfnMaintenanceWindowTaskProps{
	Priority: jsii.Number(123),
	TaskArn: jsii.String("taskArn"),
	TaskType: jsii.String("taskType"),
	WindowId: jsii.String("windowId"),

	// the properties below are optional
	CutoffBehavior: jsii.String("cutoffBehavior"),
	Description: jsii.String("description"),
	LoggingInfo: &LoggingInfoProperty{
		Region: jsii.String("region"),
		S3Bucket: jsii.String("s3Bucket"),

		// the properties below are optional
		S3Prefix: jsii.String("s3Prefix"),
	},
	MaxConcurrency: jsii.String("maxConcurrency"),
	MaxErrors: jsii.String("maxErrors"),
	Name: jsii.String("name"),
	ServiceRoleArn: jsii.String("serviceRoleArn"),
	Targets: []interface{}{
		&TargetProperty{
			Key: jsii.String("key"),
			Values: []*string{
				jsii.String("values"),
			},
		},
	},
	TaskInvocationParameters: &TaskInvocationParametersProperty{
		MaintenanceWindowAutomationParameters: &MaintenanceWindowAutomationParametersProperty{
			DocumentVersion: jsii.String("documentVersion"),
			Parameters: parameters,
		},
		MaintenanceWindowLambdaParameters: &MaintenanceWindowLambdaParametersProperty{
			ClientContext: jsii.String("clientContext"),
			Payload: jsii.String("payload"),
			Qualifier: jsii.String("qualifier"),
		},
		MaintenanceWindowRunCommandParameters: &MaintenanceWindowRunCommandParametersProperty{
			CloudWatchOutputConfig: &CloudWatchOutputConfigProperty{
				CloudWatchLogGroupName: jsii.String("cloudWatchLogGroupName"),
				CloudWatchOutputEnabled: jsii.Boolean(false),
			},
			Comment: jsii.String("comment"),
			DocumentHash: jsii.String("documentHash"),
			DocumentHashType: jsii.String("documentHashType"),
			DocumentVersion: jsii.String("documentVersion"),
			NotificationConfig: &NotificationConfigProperty{
				NotificationArn: jsii.String("notificationArn"),

				// the properties below are optional
				NotificationEvents: []*string{
					jsii.String("notificationEvents"),
				},
				NotificationType: jsii.String("notificationType"),
			},
			OutputS3BucketName: jsii.String("outputS3BucketName"),
			OutputS3KeyPrefix: jsii.String("outputS3KeyPrefix"),
			Parameters: parameters,
			ServiceRoleArn: jsii.String("serviceRoleArn"),
			TimeoutSeconds: jsii.Number(123),
		},
		MaintenanceWindowStepFunctionsParameters: &MaintenanceWindowStepFunctionsParametersProperty{
			Input: jsii.String("input"),
			Name: jsii.String("name"),
		},
	},
	TaskParameters: taskParameters,
}

Properties ​

cutoffBehavioroptionalstringcutoff_behavioroptionalstrcutoffBehavioroptionalStringCutoffBehavioroptionalstringCutoffBehavioroptional*string #
The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
A description of the task.
loggingInfooptionalIResolvable | CfnMaintenanceWindowTask.LoggingInfoPropertylogging_infooptionaltyping.Union[IResolvable, LoggingInfoProperty]loggingInfooptionalIResolvableLoggingInfooptionalIResolvableLoggingInfooptionalinterface{} #
> `LoggingInfo` has been deprecated.
notes

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 .

Information about an Amazon S3 bucket to write Run Command task-level logs to.

maxConcurrencyoptionalstringmax_concurrencyoptionalstrmaxConcurrencyoptionalStringMaxConcurrencyoptionalstringMaxConcurrencyoptional*string #
The maximum number of targets this task can be run for, in parallel.
notes

Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task 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.

maxErrorsoptionalstringmax_errorsoptionalstrmaxErrorsoptionalStringMaxErrorsoptionalstringMaxErrorsoptional*string #
The maximum number of errors allowed before this task stops being scheduled.
notes

Although this element is listed as "Required: No", a value can be omitted only when you are registering or updating a targetless task 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.

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string #
The task name.
prioritynumberpriorityint | floatpriorityNumberPrioritydoublePriority*float64 required #
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.

serviceRoleArnoptionalstringservice_role_arnoptionalstrserviceRoleArnoptionalStringServiceRoleArnoptionalstringServiceRoleArnoptional*string #
The Amazon Resource Name (ARN) of the IAM service role for AWS Systems Manager to assume when running a maintenance window task.
notes

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 in the in the AWS Systems Manager User Guide .

targetsoptionalIResolvable | IResolvable | CfnMaintenanceWindowTask.TargetProperty[]targetsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, TargetProperty]]]targetsoptionalIResolvableTargetsoptionalIResolvableTargetsoptionalinterface{} #
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* .
taskArnstringtask_arnstrtaskArnStringTaskArnstringTaskArn*string required #
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.

taskInvocationParametersoptionalIResolvable | CfnMaintenanceWindowTask.TaskInvocationParametersPropertytask_invocation_parametersoptionaltyping.Union[IResolvable, TaskInvocationParametersProperty]taskInvocationParametersoptionalIResolvableTaskInvocationParametersoptionalIResolvableTaskInvocationParametersoptionalinterface{} #
The parameters to pass to the task when it runs.
notes

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.

taskParametersoptionalanytask_parametersoptionalAnytaskParametersoptionalObjectTaskParametersoptionalobjectTaskParametersoptionalinterface{} #
> `TaskParameters` has been deprecated.
notes

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 .

The parameters to pass to the task when it runs.

taskTypestringtask_typestrtaskTypeStringTaskTypestringTaskType*string required #
The type of task.

Valid values: RUN_COMMAND , AUTOMATION , LAMBDA , STEP_FUNCTIONS .

windowIdstringwindow_idstrwindowIdStringWindowIdstringWindowId*string required #
The ID of the maintenance window where the task is registered.