CfnMaintenanceWindowTaskProps
- class aws_cdk.aws_ssm.CfnMaintenanceWindowTaskProps(*, priority, task_arn, task_type, window_id, cutoff_behavior=None, description=None, logging_info=None, max_concurrency=None, max_errors=None, name=None, service_role_arn=None, targets=None, task_invocation_parameters=None, task_parameters=None)
Bases:
object
Properties for defining a
CfnMaintenanceWindowTask
.- Parameters:
priority (
Union
[int
,float
]) – 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.task_arn (
str
) – The resource that the task uses during execution. ForRUN_COMMAND
andAUTOMATION
task types,TaskArn
is the SSM document name or Amazon Resource Name (ARN). ForLAMBDA
tasks,TaskArn
is the function name or ARN. ForSTEP_FUNCTIONS
tasks,TaskArn
is the state machine ARN.task_type (
str
) – The type of task. Valid values:RUN_COMMAND
,AUTOMATION
,LAMBDA
,STEP_FUNCTIONS
.window_id (
str
) – The ID of the maintenance window where the task is registered.cutoff_behavior (
Optional
[str
]) – The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.description (
Optional
[str
]) – A description of the task.logging_info (
Union
[IResolvable
,LoggingInfoProperty
,Dict
[str
,Any
],None
]) – Information about an Amazon S3 bucket to write Run Command task-level logs to. .. epigraph::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 .max_concurrency (
Optional
[str
]) – The maximum number of targets this task can be run for, in parallel. .. epigraph:: 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 of1
. This value doesn’t affect the running of your task.max_errors (
Optional
[str
]) –The maximum number of errors allowed before this task stops being scheduled. .. epigraph:: 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 (
Optional
[str
]) – The task name.service_role_arn (
Optional
[str
]) – 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 runRegisterTaskWithMaintenanceWindow
. 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 .targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetProperty
,Dict
[str
,Any
]]],None
]) – The targets, either instances or window target IDs. - Specify instances usingKey=InstanceIds,Values= *instanceid1* , *instanceid2*
. - Specify window target IDs usingKey=WindowTargetIds,Values= *window-target-id-1* , *window-target-id-2*
.task_invocation_parameters (
Union
[IResolvable
,TaskInvocationParametersProperty
,Dict
[str
,Any
],None
]) – 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. .. epigraph:: When you update a maintenance window task that has options specified inTaskInvocationParameters
, 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.task_parameters (
Any
) – The parameters to pass to the task when it runs. .. epigraph::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 .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 )
Attributes
- cutoff_behavior
The specification for whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
- description
A description of the task.
- logging_info
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 .
- max_concurrency
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.
- max_errors
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
The task name.
- priority
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.
- service_role_arn
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 in the in the AWS Systems Manager User Guide .
- targets
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*
.
- task_arn
The resource that the task uses during execution.
For
RUN_COMMAND
andAUTOMATION
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.
- task_invocation_parameters
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. .. epigraph:
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.
- task_parameters
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 .
- task_type
The type of task.
Valid values:
RUN_COMMAND
,AUTOMATION
,LAMBDA
,STEP_FUNCTIONS
.
- window_id
The ID of the maintenance window where the task is registered.