搭配使用 ListComplianceSummaries
與 CLI
下列程式碼範例示範如何使用 ListComplianceSummaries
。
- CLI
-
- AWS CLI
-
列出所有合規類型的合規摘要
此範例列出了帳戶中所有合規類型的合規摘要。
命令:
aws ssm list-compliance-summaries
輸出:
{ "ComplianceSummaryItems": [ { "ComplianceType": "Association", "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", "CompliantSummary": { "CompliantCount": 1, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 1 } }, "NonCompliantSummary": { "NonCompliantCount": 1, "SeveritySummary": { "CriticalCount": 1, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, ... ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }
列出特定合規類型的合規摘要
此範例列出了「修補程式」合規類型的合規摘要。
命令:
aws ssm list-compliance-summaries --filters
"Key=ComplianceType,Values=Patch,Type=EQUAL"
-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 ListComplianceSummaries
。
-
- PowerShell
-
- Tools for PowerShell
-
範例 1:此範例傳回所有合規類型的合規與不合規資源計數摘要。
Get-SSMComplianceSummaryList
輸出:
ComplianceType CompliantSummary NonCompliantSummary -------------- ---------------- ------------------- FleetTotal Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Association Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Custom:InSpec Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Patch Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary
-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考》中的 ListComplianceSummaries。
-
如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。
ListComplianceItems
ListDocumentVersions