将 DescribeInstancePatchStates 与 CLI 配合使用 - AWS Systems Manager

DescribeInstancePatchStates 与 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"

有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 将 Systems Manager 与 AWS SDK 配合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。