搭配使用 ListResourceComplianceSummaries
與 CLI
下列程式碼範例示範如何使用 ListResourceComplianceSummaries
。
- CLI
-
- AWS CLI
-
列出資源層級合規摘要計數
此範例列出了資源層級合規摘要計數。
命令:
aws ssm list-resource-compliance-summaries
輸出:
{ "ResourceComplianceSummaryItems": [ { "ComplianceType": "Association", "ResourceType": "ManagedInstance", "ResourceId": "i-1234567890abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550509273.0 }, "CompliantSummary": { "CompliantCount": 2, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 2 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, { "ComplianceType": "Patch", "ResourceType": "ManagedInstance", "ResourceId": "i-9876543210abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550248550.0, "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "ExecutionType": "Command" }, "CompliantSummary": { "CompliantCount": 397, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 397 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } } ], "NextToken": "--token string truncated--" }
列出特定合規類型的資源層級合規摘要
此範例列出了「修補程式」合規類型的資源層級合規摘要。
命令:
aws ssm list-resource-compliance-summaries --filters
"Key=ComplianceType,Values=Patch,Type=EQUAL"
-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 ListResourceComplianceSummaries
。
-
- PowerShell
-
- Tools for PowerShell
-
範例 1:此範例示範取得資源層級摘要計數。摘要包含有關合規和不合規狀態的資訊,以及符合 "Windows10" 之產品的詳細合規項目嚴重性計數。由於未不指定該參數時,MaxResult 預設為 100,且該值無效,因此新增 MaxResult 參數,並將該值設定為 50。
$FilterValues = @{ "Key"="Product" "Type"="EQUAL" "Values"="Windows10" } Get-SSMResourceComplianceSummaryList -Filter $FilterValues -MaxResult 50
-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考》中的 ListResourceComplianceSummaries。
-
如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。
ListInventoryEntries
ListTagsForResource