搭DescribeInstancePatchStates配 AWS SDK或使用 CLI - AWS SDK 程式碼範例

AWS 文檔 AWS SDK示例 GitHub 回購中有更多SDK示例

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

DescribeInstancePatchStates配 AWS SDK或使用 CLI

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

CLI
AWS CLI

取得執行處理的修補程式摘要狀態

describe-instance-patch-states範例會取得執行個體的修補程式摘要狀態。

aws ssm describe-instance-patch-states \ --instance-ids "i-1234567890abcdef0"

輸出:

{ "InstancePatchStates": [ { "InstanceId": "i-1234567890abcdef0", "PatchGroup": "my-patch-group", "BaselineId": "pb-0713accee01234567", "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", "CriticalNonCompliantCount": 2, "SecurityNonCompliantCount": 2, "OtherNonCompliantCount": 1, "InstalledCount": 123, "InstalledOtherCount": 334, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 1, "FailedCount": 2, "UnreportedNotApplicableCount": 11, "NotApplicableCount": 2063, "OperationStartTime": "2021-05-03T11:00:56-07:00", "OperationEndTime": "2021-05-03T11:01:09-07:00", "Operation": "Scan", "LastNoRebootInstallOperationTime": "2020-06-14T12:17:41-07:00", "RebootOption": "RebootIfNeeded" } ] }

如需詳細資訊,請參閱 AWS Systems Manager 使用指南中的關於修補程式符合性

PowerShell
適用的工具 PowerShell

範例 1:此範例取得執行處理的修補程式摘要狀態。

Get-SSMInstancePatchState -InstanceId "i-08ee91c0b17045407"

範例 2:此範例取得兩個執行處理的修補程式摘要狀態。

Get-SSMInstancePatchState -InstanceId "i-08ee91c0b17045407","i-09a618aec652973a9"