register_task_with_maintenance_window
¶
register_task_with_maintenance_window(
window_id: MaintenanceWindowId,
task_arn: MaintenanceWindowTaskArn,
task_type: MaintenanceWindowTaskType,
*,
config_overrides: Optional[SSMClientConfig] = 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/ssm.py
9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 | |