aws-cdk-lib.aws_ssm.CfnMaintenanceWindowTask

class CfnMaintenanceWindowTask (construct)

LanguageType name
.NETAmazon.CDK.AWS.SSM.CfnMaintenanceWindowTask
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsssm#CfnMaintenanceWindowTask
Javasoftware.amazon.awscdk.services.ssm.CfnMaintenanceWindowTask
Pythonaws_cdk.aws_ssm.CfnMaintenanceWindowTask
TypeScript aws-cdk-lib » aws_ssm » CfnMaintenanceWindowTask

Implements IConstruct, IDependable, IInspectable

A CloudFormation AWS::SSM::MaintenanceWindowTask.

The AWS::SSM::MaintenanceWindowTask resource defines information about a task for an AWS Systems Manager maintenance window. For more information, see RegisterTaskWithMaintenanceWindow in the AWS Systems Manager API Reference .

Example

// 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 cfnMaintenanceWindowTask = new ssm.CfnMaintenanceWindowTask(this, 'MyCfnMaintenanceWindowTask', {
  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,
});

Initializer

new CfnMaintenanceWindowTask(scope: Construct, id: string, props: CfnMaintenanceWindowTaskProps)

Parameters

  • scope Construct — - scope in which this resource is defined.
  • id string — - scoped id of the resource.
  • props CfnMaintenanceWindowTaskProps — - resource properties.

Create a new AWS::SSM::MaintenanceWindowTask.

Construct Props

NameTypeDescription
prioritynumberThe priority of the task in the maintenance window.
taskArnstringThe resource that the task uses during execution.
taskTypestringThe type of task.
windowIdstringThe ID of the maintenance window where the task is registered.
cutoffBehavior?stringThe specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
description?stringA description of the task.
loggingInfo?IResolvable | LoggingInfoPropertyInformation about an Amazon S3 bucket to write Run Command task-level logs to.
maxConcurrency?stringThe maximum number of targets this task can be run for, in parallel.
maxErrors?stringThe maximum number of errors allowed before this task stops being scheduled.
name?stringThe task name.
serviceRoleArn?stringThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for maintenance window Run Command tasks.
targets?IResolvable | IResolvable | TargetProperty[]The targets, either instances or window target IDs.
taskInvocationParameters?IResolvable | TaskInvocationParametersPropertyThe parameters to pass to the task when it runs.
taskParameters?anyThe parameters to pass to the task when it runs.

priority

Type: 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.


taskArn

Type: 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.


taskType

Type: string

The type of task.

Valid values: RUN_COMMAND , AUTOMATION , LAMBDA , STEP_FUNCTIONS .


windowId

Type: string

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


cutoffBehavior?

Type: string (optional)

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


description?

Type: string (optional)

A description of the task.


loggingInfo?

Type: IResolvable | LoggingInfoProperty (optional)

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

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 .


maxConcurrency?

Type: string (optional)

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 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.


maxErrors?

Type: string (optional)

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 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.


name?

Type: string (optional)

The task name.


serviceRoleArn?

Type: string (optional)

The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for maintenance window Run Command tasks.


targets?

Type: IResolvable | IResolvable | TargetProperty[] (optional)

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* .

taskInvocationParameters?

Type: IResolvable | TaskInvocationParametersProperty (optional)

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.


taskParameters?

Type: any (optional)

The parameters to pass to the task when it runs.

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 .

Properties

NameTypeDescription
cfnOptionsICfnResourceOptionsOptions for this resource, such as condition, update policy etc.
cfnProperties{ [string]: any }
cfnResourceTypestringAWS resource type.
creationStackstring[]
logicalIdstringThe logical ID for this CloudFormation stack element.
nodeNodeThe tree node.
prioritynumberThe priority of the task in the maintenance window.
refstringReturn a string that will be resolved to a CloudFormation { Ref } for this element.
stackStackThe stack in which this element is defined.
taskArnstringThe resource that the task uses during execution.
taskParametersanyThe parameters to pass to the task when it runs.
taskTypestringThe type of task.
windowIdstringThe ID of the maintenance window where the task is registered.
cutoffBehavior?stringThe specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
description?stringA description of the task.
loggingInfo?IResolvable | LoggingInfoPropertyInformation about an Amazon S3 bucket to write Run Command task-level logs to.
maxConcurrency?stringThe maximum number of targets this task can be run for, in parallel.
maxErrors?stringThe maximum number of errors allowed before this task stops being scheduled.
name?stringThe task name.
serviceRoleArn?stringThe Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for maintenance window Run Command tasks.
targets?IResolvable | IResolvable | TargetProperty[]The targets, either instances or window target IDs.
taskInvocationParameters?IResolvable | TaskInvocationParametersPropertyThe parameters to pass to the task when it runs.
static CFN_RESOURCE_TYPE_NAMEstringThe CloudFormation resource type name for this resource class.

cfnOptions

Type: ICfnResourceOptions

Options for this resource, such as condition, update policy etc.


cfnProperties

Type: { [string]: any }


cfnResourceType

Type: string

AWS resource type.


creationStack

Type: string[]


logicalId

Type: string

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).


node

Type: Node

The tree node.


priority

Type: 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.


ref

Type: string

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).


stack

Type: Stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).


taskArn

Type: 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.


taskParameters

Type: any

The parameters to pass to the task when it runs.

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 .


taskType

Type: string

The type of task.

Valid values: RUN_COMMAND , AUTOMATION , LAMBDA , STEP_FUNCTIONS .


windowId

Type: string

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


cutoffBehavior?

Type: string (optional)

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


description?

Type: string (optional)

A description of the task.


loggingInfo?

Type: IResolvable | LoggingInfoProperty (optional)

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

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 .


maxConcurrency?

Type: string (optional)

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 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.


maxErrors?

Type: string (optional)

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 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.


name?

Type: string (optional)

The task name.


serviceRoleArn?

Type: string (optional)

The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) service role to use to publish Amazon Simple Notification Service (Amazon SNS) notifications for maintenance window Run Command tasks.


targets?

Type: IResolvable | IResolvable | TargetProperty[] (optional)

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* .

taskInvocationParameters?

Type: IResolvable | TaskInvocationParametersProperty (optional)

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.


static CFN_RESOURCE_TYPE_NAME

Type: string

The CloudFormation resource type name for this resource class.

Methods

NameDescription
addDeletionOverride(path)Syntactic sugar for addOverride(path, undefined).
addDependency(target)Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addDependsOn(target)⚠️Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addMetadata(key, value)Add a value to the CloudFormation Resource Metadata.
addOverride(path, value)Adds an override to the synthesized CloudFormation resource.
addPropertyDeletionOverride(propertyPath)Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride(propertyPath, value)Adds an override to a resource property.
applyRemovalPolicy(policy?, options?)Sets the deletion policy of the resource based on the removal policy specified.
getAtt(attributeName, typeHint?)Returns a token for an runtime attribute of this resource.
getMetadata(key)Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector)Examines the CloudFormation resource and discloses attributes.
obtainDependencies()Retrieves an array of resources this resource depends on.
obtainResourceDependencies()Get a shallow copy of dependencies between this resource and other resources in the same stack.
overrideLogicalId(newLogicalId)Overrides the auto-generated logical ID with a specific ID.
removeDependency(target)Indicates that this resource no longer depends on another resource.
replaceDependency(target, newTarget)Replaces one dependency with another.
toString()Returns a string representation of this construct.
protected renderProperties(props)

addDeletionOverride(path)

public addDeletionOverride(path: string): void

Parameters

  • path string — The path of the value to delete.

Syntactic sugar for addOverride(path, undefined).


addDependency(target)

public addDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.


addDependsOn(target)⚠️

public addDependsOn(target: CfnResource): void

⚠️ Deprecated: use addDependency

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.


addMetadata(key, value)

public addMetadata(key: string, value: any): void

Parameters

  • key string
  • value any

Add a value to the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


addOverride(path, value)

public addOverride(path: string, value: any): void

Parameters

  • path string — - The path of the property, you can use dot notation to override values in complex types.
  • value any — - The value.

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');

would add the overrides

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.


addPropertyDeletionOverride(propertyPath)

public addPropertyDeletionOverride(propertyPath: string): void

Parameters

  • propertyPath string — The path to the property.

Adds an override that deletes the value of a property from the resource definition.


addPropertyOverride(propertyPath, value)

public addPropertyOverride(propertyPath: string, value: any): void

Parameters

  • propertyPath string — The path of the property.
  • value any — The value.

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).


applyRemovalPolicy(policy?, options?)

public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void

Parameters

  • policy RemovalPolicy
  • options RemovalPolicyOptions

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options


getAtt(attributeName, typeHint?)

public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference

Parameters

  • attributeName string — The name of the attribute.
  • typeHint ResolutionTypeHint

Returns

  • Reference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.


getMetadata(key)

public getMetadata(key: string): any

Parameters

  • key string

Returns

  • any

Retrieve a value value from the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


inspect(inspector)

public inspect(inspector: TreeInspector): void

Parameters

  • inspector TreeInspector — - tree inspector to collect and process attributes.

Examines the CloudFormation resource and discloses attributes.


obtainDependencies()

public obtainDependencies(): Stack &#124; CfnResource[]

Returns

  • Stack | CfnResource[]

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.


obtainResourceDependencies()

public obtainResourceDependencies(): CfnResource[]

Returns

  • CfnResource[]

Get a shallow copy of dependencies between this resource and other resources in the same stack.


overrideLogicalId(newLogicalId)

public overrideLogicalId(newLogicalId: string): void

Parameters

  • newLogicalId string — The new logical ID to use for this stack element.

Overrides the auto-generated logical ID with a specific ID.


removeDependency(target)

public removeDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.


replaceDependency(target, newTarget)

public replaceDependency(target: CfnResource, newTarget: CfnResource): void

Parameters

  • target CfnResource — The dependency to replace.
  • newTarget CfnResource — The new dependency to add.

Replaces one dependency with another.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected renderProperties(props)

protected renderProperties(props: { [string]: any }): { [string]: any }

Parameters

  • props { [string]: any }

Returns

  • { [string]: any }