class CfnMaintenanceWindowTask (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.SSM.CfnMaintenanceWindowTask |
![]() | software.amazon.awscdk.services.ssm.CfnMaintenanceWindowTask |
![]() | aws_cdk.aws_ssm.CfnMaintenanceWindowTask |
![]() | @aws-cdk/aws-ssm » CfnMaintenanceWindowTask |
Implements
IConstruct
, 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 * as ssm from '@aws-cdk/aws-ssm';
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
Cfn
— - resource properties.Maintenance Window Task Props
Create a new AWS::SSM::MaintenanceWindowTask
.
Construct Props
Name | Type | Description |
---|---|---|
priority | number | The priority of the task in the maintenance window. |
task | string | The resource that the task uses during execution. |
task | string | The type of task. |
window | string | The ID of the maintenance window where the task is registered. |
cutoff | string | The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached. |
description? | string | A description of the task. |
logging | IResolvable | Logging | Information about an Amazon S3 bucket to write Run Command task-level logs to. |
max | string | The maximum number of targets this task can be run for, in parallel. |
max | string | The maximum number of errors allowed before this task stops being scheduled. |
name? | string | The task name. |
service | string | 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? | IResolvable | IResolvable | Target [] | The targets, either instances or window target IDs. |
task | IResolvable | Task | The parameters to pass to the task when it runs. |
task | any | The 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
|
Logging
(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 theOutputS3BucketName
andOutputS3KeyPrefix
options in theTaskInvocationParameters
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
|
Target
[]
(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
|
Task
(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 theTaskInvocationParameters
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 specifiedTaskInvocationParameters
values forComment
,NotificationConfig
, andOutputS3BucketName
. If you update the maintenance window task and specify only a differentOutputS3BucketName
value, the values forComment
andNotificationConfig
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 theParameters
option in theTaskInvocationParameters
structure. For information about how Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters .
Properties
Name | Type | Description |
---|---|---|
cfn | ICfn | Options for this resource, such as condition, update policy etc. |
cfn | { [string]: any } | |
cfn | string | AWS resource type. |
creation | string[] | |
logical | string | The logical ID for this CloudFormation stack element. |
node | Construct | The construct tree node associated with this construct. |
priority | number | The priority of the task in the maintenance window. |
ref | string | Return a string that will be resolved to a CloudFormation { Ref } for this element. |
stack | Stack | The stack in which this element is defined. |
task | string | The resource that the task uses during execution. |
task | any | The parameters to pass to the task when it runs. |
task | string | The type of task. |
window | string | The ID of the maintenance window where the task is registered. |
cutoff | string | The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached. |
description? | string | A description of the task. |
logging | IResolvable | Logging | Information about an Amazon S3 bucket to write Run Command task-level logs to. |
max | string | The maximum number of targets this task can be run for, in parallel. |
max | string | The maximum number of errors allowed before this task stops being scheduled. |
name? | string | The task name. |
service | string | 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? | IResolvable | IResolvable | Target [] | The targets, either instances or window target IDs. |
task | IResolvable | Task | The parameters to pass to the task when it runs. |
static CFN_RESOURCE_TYPE_NAME | string | The CloudFormation resource type name for this resource class. |
cfnOptions
Type:
ICfn
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:
Construct
The construct tree node associated with this construct.
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 theParameters
option in theTaskInvocationParameters
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
|
Logging
(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 theOutputS3BucketName
andOutputS3KeyPrefix
options in theTaskInvocationParameters
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
|
Target
[]
(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
|
Task
(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 theTaskInvocationParameters
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 specifiedTaskInvocationParameters
values forComment
,NotificationConfig
, andOutputS3BucketName
. If you update the maintenance window task and specify only a differentOutputS3BucketName
value, the values forComment
andNotificationConfig
are removed.
static CFN_RESOURCE_TYPE_NAME
Type:
string
The CloudFormation resource type name for this resource class.
Methods
Name | Description |
---|---|
add | Syntactic sugar for addOverride(path, undefined) . |
add | Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
add | Add a value to the CloudFormation Resource Metadata. |
add | Adds an override to the synthesized CloudFormation resource. |
add | Adds an override that deletes the value of a property from the resource definition. |
add | Adds an override to a resource property. |
apply | Sets the deletion policy of the resource based on the removal policy specified. |
get | Returns a token for an runtime attribute of this resource. |
get | Retrieve a value value from the CloudFormation Resource Metadata. |
inspect(inspector) | Examines the CloudFormation resource and discloses attributes. |
override | Overrides the auto-generated logical ID with a specific ID. |
to | Returns a string representation of this construct. |
protected render |
addDeletionOverride(path)
public addDeletionOverride(path: string): void
Parameters
- path
string
— The path of the value to delete.
Syntactic sugar for addOverride(path, undefined)
.
addDependsOn(target)
public addDependsOn(target: CfnResource): void
Parameters
- target
Cfn
Resource
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.
addMetadata(key, value)
public addMetadata(key: string, value: any): void
Parameters
- key
string
- value
any
Add a value to the CloudFormation Resource Metadata.
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
Removal
Policy - options
Removal
Policy Options
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
).
getAtt(attributeName)
public getAtt(attributeName: string): Reference
Parameters
- attributeName
string
— The name of the attribute.
Returns
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.
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
Tree
— - tree inspector to collect and process attributes.Inspector
Examines the CloudFormation resource and discloses attributes.
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.
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 }