将 DescribeEffectivePatchesForPatchBaseline
与 CLI 配合使用
以下代码示例演示如何使用 DescribeEffectivePatchesForPatchBaseline
。
- CLI
-
- AWS CLI
-
示例 1:获取自定义补丁基准定义的所有补丁
以下
describe-effective-patches-for-patch-baseline
示例返回当前 AWS 账户中由自定义补丁基准定义的补丁。请注意,对于自定义基准,--baseline-id
只需要 ID 。aws ssm describe-effective-patches-for-patch-baseline \ --baseline-id
"pb-08b654cf9b9681f04"
输出:
{ "EffectivePatches": [ { "Patch": { "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", "ReleaseDate": 1544047205.0, "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4470788", "MsrcNumber": "", "Language": "All" }, "PatchStatus": { "DeploymentStatus": "APPROVED", "ComplianceLevel": "CRITICAL", "ApprovalDate": 1544047205.0 } }, { "Patch": { "Id": "915a6b1a-f556-4d83-8f50-b2e75a9a7e58", "ReleaseDate": 1549994400.0, "Title": "2019-02 Cumulative Update for .NET Framework 3.5 and 4.7.2 for Windows Server 2019 for x64 (KB4483452)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4483452", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Important", "KbNumber": "KB4483452", "MsrcNumber": "", "Language": "All" }, "PatchStatus": { "DeploymentStatus": "APPROVED", "ComplianceLevel": "CRITICAL", "ApprovalDate": 1549994400.0 } }, ... ], "NextToken": "--token string truncated--" }
示例 2:获取由 AWS 托管式补丁基准定义的所有补丁
以下
describe-effective-patches-for-patch-baseline
示例返回由 AWS 托管式补丁基准定义的补丁。请注意,对于 AWS 托管式基准,--baseline-id
需要完整的基准 ARNaws ssm describe-effective-patches-for-patch-baseline \ --baseline-id
"arn:aws:ssm:us-east-2:733109147000:patchbaseline/pb-020d361a05defe4ed"
有关输出示例,请参阅示例 1。
有关更多信息,请参阅《AWS Systems Manager 用户指南》中的如何选择安全补丁。
-
有关 API 详细信息,请参阅《AWS CLI Command Reference》中的 DescribeEffectivePatchesForPatchBaseline
。
-
- PowerShell
-
- 适用于 PowerShell 的工具
-
示例 1:此示例列出所有补丁基准,最大结果列表为 1。
Get-SSMEffectivePatchesForPatchBaseline -BaselineId "pb-0a2f1059b670ebd31" -MaxResult 1
输出:
Patch PatchStatus ----- ----------- Amazon.SimpleSystemsManagement.Model.Patch Amazon.SimpleSystemsManagement.Model.PatchStatus
示例 2:此示例显示所有补丁基准的补丁状态,最大结果列表为 1。
(Get-SSMEffectivePatchesForPatchBaseline -BaselineId "pb-0a2f1059b670ebd31" -MaxResult 1).PatchStatus
输出:
ApprovalDate DeploymentStatus ------------ ---------------- 12/21/2010 6:00:00 PM APPROVED
-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference》中的 DescribeEffectivePatchesForPatchBaseline。
-
有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 将 Systems Manager 与 AWS SDK 配合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
DescribeEffectiveInstanceAssociations
DescribeInstanceAssociationsStatus