register_task_with_maintenance_window
async
¶
register_task_with_maintenance_window(
window_id: MaintenanceWindowId,
task_arn: MaintenanceWindowTaskArn,
task_type: MaintenanceWindowTaskType,
*,
config_overrides: Optional[AsyncSSMClientConfig] = None,
targets: Optional[Targets] = None,
service_role_arn: Optional[ServiceRole] = None,
task_parameters: Optional[MaintenanceWindowTaskParameters] = None,
task_invocation_parameters: Optional[
MaintenanceWindowTaskInvocationParameters
] = None,
priority: Optional[MaintenanceWindowTaskPriority] = None,
max_concurrency: Optional[MaxConcurrency] = None,
max_errors: Optional[MaxErrors] = None,
logging_info: Optional[LoggingInfo] = None,
name: Optional[MaintenanceWindowName] = None,
description: Optional[MaintenanceWindowDescription] = None,
client_token: Optional[ClientToken] = None,
cutoff_behavior: Optional[MaintenanceWindowTaskCutoffBehavior] = None,
alarm_configuration: Optional[AlarmConfiguration] = None,
) -> RegisterTaskWithMaintenanceWindowResult
Adds a new task to a maintenance window.
Parameters:
-
window_id(MaintenanceWindowId) –The ID of the maintenance window the task should be added to.
-
targets(Optional[Targets], default:None) –The targets (either managed nodes or maintenance window targets).
One or more targets must be specified for maintenance window Run Command-type tasks. Depending on the task, targets are optional for other maintenance window task types (Automation, Lambda, and Step Functions). For more information about running tasks that don't specify targets, see Registering maintenance window tasks without targets in the Amazon Web Services Systems Manager User Guide.
Specify managed nodes using the following format:
Key=InstanceIds,Values=, Specify maintenance window targets using the following format:
Key=WindowTargetIds,Values=, -
task_arn(MaintenanceWindowTaskArn) –The ARN of the task to run.
-
service_role_arn(Optional[ServiceRole], default:None) –The Amazon Resource Name (ARN) of the IAM service role for Amazon Web Services 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 Amazon Web Services Systems Manager User Guide.
-
task_type(MaintenanceWindowTaskType) –The type of task being registered.
-
task_parameters(Optional[MaintenanceWindowTaskParameters], default:None) –The parameters that should be passed to the task when it is run.
TaskParametershas been deprecated. To specify parameters to pass to a task when it runs, instead use theParametersoption in theTaskInvocationParametersstructure. For information about how Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters. -
task_invocation_parameters(Optional[MaintenanceWindowTaskInvocationParameters], default:None) –The parameters that the task should use during execution. Populate only the fields that match the task type. All other fields should be empty.
-
priority(Optional[MaintenanceWindowTaskPriority], default:None) –The priority of the task in the maintenance window, the lower the number the higher the priority. Tasks in a maintenance window are scheduled in priority order with tasks that have the same priority scheduled in parallel.
-
max_concurrency(Optional[MaxConcurrency], default:None) –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(Optional[MaxErrors], default:None) –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. -
logging_info(Optional[LoggingInfo], default:None) –A structure containing information about an Amazon Simple Storage Service (Amazon S3) bucket to write managed node-level logs to.
LoggingInfohas been deprecated. To specify an Amazon Simple Storage Service (Amazon S3) bucket to contain logs, instead use theOutputS3BucketNameandOutputS3KeyPrefixoptions in theTaskInvocationParametersstructure. For information about how Amazon Web Services Systems Manager handles these options for the supported maintenance window task types, see MaintenanceWindowTaskInvocationParameters. -
name(Optional[MaintenanceWindowName], default:None) –An optional name for the task.
-
description(Optional[MaintenanceWindowDescription], default:None) –An optional description for the task.
-
client_token(Optional[ClientToken], default:None) –User-provided idempotency token.
-
cutoff_behavior(Optional[MaintenanceWindowTaskCutoffBehavior], default:None) –Indicates whether tasks should continue to run after the cutoff time specified in the maintenance windows is reached.
-
CONTINUE_TASK: When the cutoff time is reached, any tasks that are running continue. The default value. -
CANCEL_TASK:-
For Automation, Lambda, Step Functions tasks: When the cutoff time is reached, any task invocations that are already running continue, but no new task invocations are started.
-
For Run Command tasks: When the cutoff time is reached, the system sends a CancelCommand operation that attempts to cancel the command associated with the task. However, there is no guarantee that the command will be terminated and the underlying process stopped.
The status for tasks that are not completed is
TIMED_OUT. -
-
-
alarm_configuration(Optional[AlarmConfiguration], default:None) –The CloudWatch alarm you want to apply to your maintenance window task.
Raises:
-
DoesNotExistException–Error returned when the ID specified for a resource, such as a maintenance window or patch baseline, doesn't exist.
For information about resource quotas in Amazon Web Services Systems Manager, see Systems Manager service quotas in the Amazon Web Services General Reference.
-
FeatureNotAvailableException–You attempted to register a
LAMBDAorSTEP_FUNCTIONStask in a region where the corresponding service isn't available. -
IdempotentParameterMismatch–Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token.
-
InternalServerError–An error occurred on the server side.
-
ResourceLimitExceededException–Error returned when the caller has exceeded the default resource quotas. For example, too many maintenance windows or patch baselines have been created.
For information about resource quotas in Systems Manager, see Systems Manager service quotas in the Amazon Web Services General Reference.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ssm/_services/async_ssm.py
10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 | |