CLI와 DescribeAvailablePatches 함께 사용 - AWS SDK 코드 예제

AWS Doc SDK ExamplesWord AWS SDK 리포지토리에는 더 많은 GitHub 예제가 있습니다.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

CLI와 DescribeAvailablePatches 함께 사용

다음 코드 예제는 DescribeAvailablePatches의 사용 방법을 보여 줍니다.

CLI
AWS CLI

사용 가능한 패치를 가져오는 방법

다음 describe-available-patches 예제에서는 MSRC 심각도가 Critical인 Windows Server 2019에서 사용 가능한 모든 패치에 대한 세부 정보를 검색합니다.

aws ssm describe-available-patches \ --filters "Key=PRODUCT,Values=WindowsServer2019" "Key=MSRC_SEVERITY,Values=Critical"

출력:

{ "Patches": [ { "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" }, { "Id": "c96115e1-5587-4115-b851-22baa46a3f11", "ReleaseDate": 1549994410.0, "Title": "2019-02 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4487038)", "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/4487038", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4487038", "MsrcNumber": "", "Language": "All" }, ... ] }

특정 패치의 세부 정보를 가져오는 방법

다음 describe-available-patches 예제에서는 지정된 패치에 대한 세부 정보를 검색합니다.

aws ssm describe-available-patches \ --filters "Key=PATCH_ID,Values=KB4480979"

출력:

{ "Patches": [ { "Id": "680861e3-fb75-432e-818e-d72e5f2be719", "ReleaseDate": 1546970408.0, "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", "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/4480979", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2016", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4480979", "MsrcNumber": "", "Language": "All" } ] }

자세한 내용은 AWS Systems Manager 사용 설명서의 Patch Manager 작업 작동 방법을 참조하세요.

PowerShell
for PowerShell 도구

예제 1:이 예제에서는 MSRC 심각도가 Critical인 Windows Server 2012에 사용할 수 있는 모든 패치를 가져옵니다. 이 예제에서 사용하는 구문에는 PowerShell 버전 3 이상이 필요합니다.

$filter1 = @{Key="PRODUCT";Values=@("WindowsServer2012")} $filter2 = @{Key="MSRC_SEVERITY";Values=@("Critical")} Get-SSMAvailablePatch -Filter $filter1,$filter2

출력:

Classification : SecurityUpdates ContentUrl : https://support.microsoft.com/en-us/kb/2727528 Description : A security issue has been identified that could allow an unauthenticated remote attacker to compromise your system and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this update, you may have to restart your system. Id : 1eb507be-2040-4eeb-803d-abc55700b715 KbNumber : KB2727528 Language : All MsrcNumber : MS12-072 MsrcSeverity : Critical Product : WindowsServer2012 ProductFamily : Windows ReleaseDate : 11/13/2012 6:00:00 PM Title : Security Update for Windows Server 2012 (KB2727528) Vendor : Microsoft ...

예제 2: PowerShell 버전 2에서는 New-Object를 사용하여 각 필터를 생성해야 합니다.

$filter1 = New-Object Amazon.SimpleSystemsManagement.Model.PatchOrchestratorFilter $filter1.Key = "PRODUCT" $filter1.Values = "WindowsServer2012" $filter2 = New-Object Amazon.SimpleSystemsManagement.Model.PatchOrchestratorFilter $filter2.Key = "MSRC_SEVERITY" $filter2.Values = "Critical" Get-SSMAvailablePatch -Filter $filter1,$filter2

예제 3:이 예제는 지난 20일 동안 릴리스되고 WindowsServer2019와 일치하는 제품에 적용되는 모든 업데이트를 가져옵니다.

Get-SSMAvailablePatch | Where-Object ReleaseDate -ge (Get-Date).AddDays(-20) | Where-Object Product -eq "WindowsServer2019" | Select-Object ReleaseDate, Product, Title

출력:

ReleaseDate Product Title ----------- ------- ----- 4/9/2019 5:00:12 PM WindowsServer2019 2019-04 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4493478) 4/9/2019 5:00:06 PM WindowsServer2019 2019-04 Cumulative Update for Windows Server 2019 for x64-based Systems (KB4493509) 4/2/2019 5:00:06 PM WindowsServer2019 2019-03 Servicing Stack Update for Windows Server 2019 for x64-based Systems (KB4493510)