搭配使用 GetMaintenanceWindowExecution 與 CLI - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

搭配使用 GetMaintenanceWindowExecution 與 CLI

下列程式碼範例示範如何使用 GetMaintenanceWindowExecution

CLI
AWS CLI

取得維護時段任務執行的相關資訊

下列 get-maintenance-window-execution 範例列出了有關作為指定維護時段執行的一部分執行之任務的資訊。

aws ssm get-maintenance-window-execution \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE"

輸出:

{ "Status": "SUCCESS", "TaskIds": [ "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE" ], "StartTime": 1487692834.595, "EndTime": 1487692835.051, "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", }

如需詳細資訊,請參閱《AWS Systems Manager 使用者指南》中的 View Information About Tasks and Task Executions (AWS CLI)

PowerShell
Tools for PowerShell V4

範例 1:此範例列出了作為維護時段執行的一部分執行之任務的資訊。

Get-SSMMaintenanceWindowExecution -WindowExecutionId "518d5565-5969-4cca-8f0e-da3b2a638355"

輸出:

EndTime : 2/21/2017 4:00:35 PM StartTime : 2/21/2017 4:00:34 PM Status : FAILED StatusDetails : One or more tasks in the orchestration failed. TaskIds : {ac0c6ae1-daa3-4a89-832e-d384503b6586} WindowExecutionId : 518d5565-5969-4cca-8f0e-da3b2a638355
Tools for PowerShell V5

範例 1:此範例列出了作為維護時段執行的一部分執行之任務的資訊。

Get-SSMMaintenanceWindowExecution -WindowExecutionId "518d5565-5969-4cca-8f0e-da3b2a638355"

輸出:

EndTime : 2/21/2017 4:00:35 PM StartTime : 2/21/2017 4:00:34 PM Status : FAILED StatusDetails : One or more tasks in the orchestration failed. TaskIds : {ac0c6ae1-daa3-4a89-832e-d384503b6586} WindowExecutionId : 518d5565-5969-4cca-8f0e-da3b2a638355