搭配使用 UpdatePatchBaseline 與 CLI - AWS Systems Manager

搭配使用 UpdatePatchBaseline 與 CLI

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

CLI
AWS CLI

範例 1:更新修補基準

下列 update-patch-baseline 範例示範將指定修補程式新增到指定修補基準,兩個修補程式新增為已拒絕,一個修補程式新增為已核准。

aws ssm update-patch-baseline \ --baseline-id "pb-0123456789abcdef0" \ --rejected-patches "KB2032276" "MS10-048" \ --approved-patches "KB2124261"

輸出:

{ "BaselineId": "pb-0123456789abcdef0", "Name": "WindowsPatching", "OperatingSystem": "WINDOWS", "GlobalFilters": { "PatchFilters": [] }, "ApprovalRules": { "PatchRules": [ { "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "WindowsServer2016" ] } ] }, "ComplianceLevel": "CRITICAL", "ApproveAfterDays": 0, "EnableNonSecurity": false } ] }, "ApprovedPatches": [ "KB2124261" ], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "RejectedPatches": [ "KB2032276", "MS10-048" ], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "CreatedDate": 1550244180.465, "ModifiedDate": 1550244180.465, "Description": "Patches for Windows Servers", "Sources": [] }

範例 2:重新命名修補基準

下列 update-patch-baseline 範例示範重新命名指定的修補基準。

aws ssm update-patch-baseline \ --baseline-id "pb-0713accee01234567" \ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates"

如需詳細資訊,請參閱《AWS Systems Manager 使用者指南》中的「更新或刪除修補基準」<https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-baseline-update-or-delete.html>`__。

PowerShell
Tools for PowerShell

範例 1:此範例示範將修補程式新增到現有修補基準,兩個修補程式新增為已拒絕,一個修補程式新增為已核准。

Update-SSMPatchBaseline -BaselineId "pb-03da896ca3b68b639" -RejectedPatch "KB2032276","MS10-048" -ApprovedPatch "KB2124261"

輸出:

ApprovalRules : Amazon.SimpleSystemsManagement.Model.PatchRuleGroup ApprovedPatches : {KB2124261} BaselineId : pb-03da896ca3b68b639 CreatedDate : 3/3/2017 5:02:19 PM Description : Baseline containing all updates approved for production systems GlobalFilters : Amazon.SimpleSystemsManagement.Model.PatchFilterGroup ModifiedDate : 3/3/2017 5:22:10 PM Name : Production-Baseline RejectedPatches : {KB2032276, MS10-048}
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考》中的 UpdatePatchBaseline

如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。