本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用適用於 AMS Accelerate 的 Systems Manager 命令列界面 (CLI) 建立維護時段
若要使用命令列界面建立 AMS Accelerate 維護時段:
遵循 SSM 教學課程:建立和設定維護時段 (AWS CLI)。對於教學課程的每個步驟,以下是用於修補的範例 CLI 命令。
注意
這些範例專屬於 Linux 或 macOS。命令也可以從中執行 AWS CloudShell ,其可能比
awscli在本機電腦上設定更簡單。如需詳細資訊,請參閱使用 AWS CloudShell 。- 
              
在教學課程的步驟 1 中,若要建立維護時段:
aws ssm create-maintenance-window \ --name Sample-Maintenance-Window \ --schedule "cron(0 30 23 ? * TUE#2 *)" \ --duration 4 \ --cutoff 1 \ --allow-unassociated-targets \ --tags "Key=Environment,Value=Production"成功完成時,
window-id會傳回 。 - 
              
在教學課程的步驟 2 中,註冊目標節點:
aws ssm register-target-with-maintenance-window \ --window-id "mw-xxxxxxxxx" \ --resource-type "INSTANCE" \ --target "Key=tag:Environment,Values=Prod"成功完成時,會傳回
WindowTargetID。 在教學課程的步驟 3 中,註冊任務:
aws ssm register-task-with-maintenance-window \ --window-id "mw-xxxxxx" \ --targets "Key=WindowTargetIds,Values=63d4f63c-xxxxxx-9b1d-xxxxxfff" \ --task-arn "AWSManagedServices-PatchInstance" \ --service-role-arn "arn:aws:iam::AWS-Account-ID:role/ams_ssm_automation_role" \ --task-invocation-parameters "{\"Automation\":{\"DocumentVersion\":\"\$DEFAULT\",\"Parameters\":{\"InstanceId\":[\"{{TARGET_ID}}\"],\"StartInactiveInstances\":[\"True\"]}}}" \ --max-concurrency 50 \ --max-errors 50 \ --name "AutomationExample" \ --description "Sample Description" \ --task-type=AUTOMATION
-