PATH:
usr
/
local
/
jetapps
/
var
/
lib
/
aws
/
lib
/
python2.7
/
site-packages
/
awscli
/
examples
/
ssm
**To register an Automation task with a Maintenance Window** This example registers an Automation task with a Maintenance Window that is targeted at an instance. Command:: aws ssm register-task-with-maintenance-window --window-id "mw-082dcd7649dee04e4" --targets Key=InstanceIds,Values=i-12345201220f8cd0d --task-arn AWS-RestartEC2Instance --service-role-arn arn:aws:iam::111222333444:role/SSM --task-type AUTOMATION --task-invocation-parameters "{\"Automation\":{\"DocumentVersion\":\"\$LATEST\",\"Parameters\":{\"InstanceId\":[\"{{TARGET_ID}}\"]}}}" --priority 0 --max-concurrency 1 --max-errors 1 --name "AutomationExample" --description "Restarting EC2 Instance for maintenance" Output:: { "WindowTaskId":"11144444-5555-6666-7777-88888888" } **To register a Lambda task with a Maintenance Window** This example registers a Lambda task with a Maintenance Window that is targeted at an instance. Command:: aws ssm register-task-with-maintenance-window --window-id "mw-082dcd7649dee04e4" --targets Key=InstanceIds,Values=i-12344d305eea74171 --task-arn arn:aws:lambda:us-east-1:111222333444:function:SSMTestLAMBDA --service-role-arn arn:aws:iam::111222333444:role/SSM --task-type LAMBDA --task-invocation-parameters '{"Lambda":{"Payload":"{\"targetId\":\"{{TARGET_ID}}\",\"targetType\":\"{{TARGET_TYPE}}\"}","Qualifier":"$LATEST"}}' --priority 0 --max-concurrency 10 --max-errors 5 --name "Lambda_Example" --description "My Lambda Example" Output:: { "WindowTaskId":"22244444-5555-6666-7777-88888888" } **To register a Run Command task with a Maintenance Window** This example registers a Run Command task with a Maintenance Window that is targeted at an instance. Command:: aws ssm register-task-with-maintenance-window --window-id "mw-082dcd7649dee04e4" --targets "Key=InstanceIds,Values=i-12344d305eea74171" --service-role-arn "arn:aws:iam::111222333444:role/SSM" --task-type "RUN_COMMAND" --name "SSMInstallPowerShellModule" --task-arn "AWS-InstallPowerShellModule" --task-invocation-parameters "{\"RunCommand\":{\"Comment\":\"\",\"OutputS3BucketName\":\"runcommandlogs\",\"Parameters\":{\"commands\":[\"Get-Module -ListAvailable\"],\"executionTimeout\":[\"3600\"],\"source\":[\"https:\/\/gallery.technet.microsoft.com\/EZOut-33ae0fb7\/file\/110351\/1\/EZOut.zip\"],\"workingDirectory\":[\"\\\\\"]},\"TimeoutSeconds\":600}}" --max-concurrency 1 --max-errors 1 --priority 10 Output:: { "WindowTaskId":"33344444-5555-6666-7777-88888888" } **To register a Step Functions task with a Maintenance Window** This example registers a Step Functions task with a Maintenance Window that is targeted at an instance. Command:: aws ssm register-task-with-maintenance-window --window-id "mw-1234d787d641f11f3" --targets Key=WindowTargetIds,Values=12347414-69c3-49f8-95b8-ed2dcf045faa --task-arn arn:aws:states:us-east-1:111222333444:stateMachine:SSMTestStateMachine --service-role-arn arn:aws:iam::111222333444:role/MaintenanceWindows --task-type STEP_FUNCTIONS --task-invocation-parameters '{"StepFunctions":{"Input":"{\"instanceId\":\"{{TARGET_ID}}\"}"}}' --priority 0 --max-concurrency 10 --max-errors 5 --name "Step_Functions_Example" --description "My Step Functions Example" Output:: { "WindowTaskId":"44444444-5555-6666-7777-88888888" } **To register a task using a Maintenance Windows target ID** This example registers a task using a Maintenance Window target ID. The Maintenance Window target ID was in the output of the ``aws ssm register-target-with-maintenance-window`` command, otherwise you can retrieve it from the output of the ``aws ssm describe-maintenance-window-targets`` command. Command:: aws ssm register-task-with-maintenance-window --targets "Key=WindowTargetIds,Values=350d44e6-28cc-44e2-951f-4b2c985838f6" --task-arn "AWS-RunShellScript" --service-role-arn "arn:aws:iam::812345678901:role/MaintenanceWindowsRole" --window-id "mw-ab12cd34ef56gh78" --task-type "RUN_COMMAND" --task-parameters "{\"commands\":{\"Values\":[\"df\"]}}" --max-concurrency 1 --max-errors 1 --priority 10
[+]
..
[-] list-compliance-items.rst
[edit]
[-] list-command-invocations.rst
[edit]
[-] describe-automation-step-executions.rst
[edit]
[-] update-service-setting.rst
[edit]
[-] get-parameters.rst
[edit]
[-] send-automation-signal.rst
[edit]
[-] get-service-setting.rst
[edit]
[-] describe-maintenance-windows.rst
[edit]
[-] create-maintenance-window.rst
[edit]
[-] put-parameter.rst
[edit]
[-] delete-maintenance-window.rst
[edit]
[-] get-maintenance-window-task.rst
[edit]
[-] describe-association-execution-targets.rst
[edit]
[-] delete-inventory.rst
[edit]
[-] describe-patch-baselines.rst
[edit]
[-] list-associations.rst
[edit]
[-] get-maintenance-window-execution-task-invocation.rst
[edit]
[-] get-parameters-by-path.rst
[edit]
[-] get-parameter-history.rst
[edit]
[-] start-session.rst
[edit]
[-] update-maintenance-window-target.rst
[edit]
[-] get-default-patch-baseline.rst
[edit]
[-] describe-sessions.rst
[edit]
[-] put-inventory.rst
[edit]
[-] list-document-versions.rst
[edit]
[-] describe-instance-patch-states-for-patch-group.rst
[edit]
[-] describe-effective-patches-for-patch-baseline.rst
[edit]
[-] describe-maintenance-window-execution-tasks.rst
[edit]
[-] describe-association.rst
[edit]
[-] describe-effective-instance-associations.rst
[edit]
[-] describe-document-permission.rst
[edit]
[-] delete-association.rst
[edit]
[-] update-patch-baseline.rst
[edit]
[-] describe-instance-associations-status.rst
[edit]
[-] list-resource-data-sync.rst
[edit]
[-] describe-maintenance-window-tasks.rst
[edit]
[-] describe-document.rst
[edit]
[-] register-target-with-maintenance-window.rst
[edit]
[-] remove-tags-from-resource.rst
[edit]
[-] get-inventory.rst
[edit]
[-] delete-document.rst
[edit]
[-] list-compliance-summaries.rst
[edit]
[-] resume-session.rst
[edit]
[-] put-compliance-items.rst
[edit]
[-] create-association-batch.rst
[edit]
[-] delete-parameters.rst
[edit]
[-] delete-activation.rst
[edit]
[-] stop-automation-execution.rst
[edit]
[-] describe-maintenance-window-targets.rst
[edit]
[-] create-association.rst
[edit]
[-] update-maintenance-window.rst
[edit]
[-] update-document-default-version.rst
[edit]
[-] delete-resource-data-sync.rst
[edit]
[-] list-inventory-entries.rst
[edit]
[-] describe-maintenance-windows-for-target.rst
[edit]
[-] describe-maintenance-window-schedule.rst
[edit]
[-] create-patch-baseline.rst
[edit]
[-] describe-patch-groups.rst
[edit]
[-] describe-parameters.rst
[edit]
[-] get-parameter.rst
[edit]
[-] get-inventory-schema.rst
[edit]
[-] start-automation-execution.rst
[edit]
[-] cancel-command.rst
[edit]
[-] list-tags-for-resource.rst
[edit]
[-] get-automation-execution.rst
[edit]
[-] get-patch-baseline-for-patch-group.rst
[edit]
[-] create-activation.rst
[edit]
[-] describe-maintenance-window-executions.rst
[edit]
[-] list-documents.rst
[edit]
[-] register-task-with-maintenance-window.rst
[edit]
[-] deregister-target-from-maintenance-window.rst
[edit]
[-] get-deployable-patch-snapshot-for-instance.rst
[edit]
[-] describe-association-executions.rst
[edit]
[-] describe-activations.rst
[edit]
[-] update-association.rst
[edit]
[-] terminate-session.rst
[edit]
[-] deregister-managed-instance.rst
[edit]
[-] create-resource-data-sync.rst
[edit]
[-] describe-instance-information.rst
[edit]
[-] update-managed-instance-role.rst
[edit]
[-] get-document.rst
[edit]
[-] list-resource-compliance-summaries.rst
[edit]
[-] register-default-patch-baseline.rst
[edit]
[-] describe-maintenance-window-execution-task-invocations.rst
[edit]
[-] deregister-patch-baseline-for-patch-group.rst
[edit]
[-] get-maintenance-window-execution-task.rst
[edit]
[-] register-patch-baseline-for-patch-group.rst
[edit]
[-] create-document.rst
[edit]
[-] update-document.rst
[edit]
[-] update-association-status.rst
[edit]
[-] list-association-versions.rst
[edit]
[-] list-commands.rst
[edit]
[-] update-maintenance-window-task.rst
[edit]
[-] describe-instance-patch-states.rst
[edit]
[-] describe-instance-patches.rst
[edit]
[-] label-parameter-version.rst
[edit]
[-] describe-inventory-deletions.rst
[edit]
[-] describe-automation-executions.rst
[edit]
[-] get-command-invocation.rst
[edit]
[-] get-maintenance-window-execution.rst
[edit]
[-] deregister-task-from-maintenance-window.rst
[edit]
[-] start-associations-once.rst
[edit]
[-] send-command.rst
[edit]
[-] get-patch-baseline.rst
[edit]
[-] add-tags-to-resource.rst
[edit]
[-] get-maintenance-window.rst
[edit]
[-] cancel-maintenance-window-execution.rst
[edit]
[-] modify-document-permission.rst
[edit]
[-] get-connection-status.rst
[edit]
[-] delete-patch-baseline.rst
[edit]
[-] delete-parameter.rst
[edit]
[-] describe-available-patches.rst
[edit]
[-] describe-patch-group-state.rst
[edit]