DescribeInstancePatchStates与 a 一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DescribeInstancePatchStates与 a 一起使用 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"