CmdID

CmdID / aws / aws ssm

aws ssm list-compliance-items

For a specified resource ID, this API operation returns a list of compliance statuses for different resource types. AWS CLI reference

3 examples 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To list compliance items for a specific instance

The following list-compliance-items example lists all compliance items for the specified instance.

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance"Identify
--resource-idsThe ID for the resources from which to get compliance information.
--resource-typesThe type of resource from which to get compliance information.
Its output, shortened
{
    "ComplianceItems": [
        {
            "ComplianceType": "Association",
            "ResourceType": "ManagedInstance",
            "ResourceId": "i-1234567890abcdef0",
            "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "Title": "",
            "Status": "COMPLIANT",
            "Severity": "UNSPECIFIED",
            "ExecutionSummary": {
                "ExecutionTime": 1550408470.0
            },
            "Details": {
                "DocumentName": "AWS-GatherSoftwareInventory",
                "DocumentVersion": "1"
            }
        },
        {
            "ComplianceType": "Association",
            "ResourceType": "ManagedInstance",
            "ResourceId": "i-1234567890abcdef0",
            "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "Title": "",
            "Status": "COMPLIANT",
            "Severity": "UNSPECIFIED",
            "ExecutionSummary": {
                "ExecutionTime": 1550508475.0
            },
            "Details": {
… 7 more lines

For more information, see Learn details about Compliance in the AWS Systems Manager User Guide.

Example 2: To list compliance items for a specific instance and association ID

The following list-compliance-items example lists all compliance items for the specified instance and association ID.

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance" --filters "Key=ComplianceType,Values=Association,Type=EQUAL" "Key=Id,Values=a1b2c3d4-5678-90ab-cdef-EXAMPLE22222,Type=EQUAL"Identify
--resource-idsThe ID for the resources from which to get compliance information.
--resource-typesThe type of resource from which to get compliance information.
--filtersOne or more compliance filters.
Its output
{
    "ComplianceItems": [
        {
            "ComplianceType": "Association",
            "ResourceType": "ManagedInstance",
            "ResourceId": "i-1234567890abcdef0",
            "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "Title": "",
            "Status": "COMPLIANT",
            "Severity": "UNSPECIFIED",
            "ExecutionSummary": {
                "ExecutionTime": 1550508475.0
            },
            "Details": {
                "DocumentName": "AWS-UpdateSSMAgent",
                "DocumentVersion": "1"
            }
        }
    ]
}

For more information, see Learn details about Compliance in the AWS Systems Manager User Guide.

Example 3: To list compliance items for an instance after a specific date and time

The following list-compliance-items example lists all compliance items for an instance after the specified date and time.

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance" --filters "Key=ExecutionTime,Values=2019-02-18T16:00:00Z,Type=GREATER_THAN"Identify
--resource-idsThe ID for the resources from which to get compliance information.
--resource-typesThe type of resource from which to get compliance information.
--filtersOne or more compliance filters.
Its output
{
    "ComplianceItems": [
        {
            "ComplianceType": "Association",
            "ResourceType": "ManagedInstance",
            "ResourceId": "i-1234567890abcdef0",
            "Id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "Title": "",
            "Status": "COMPLIANT",
            "Severity": "UNSPECIFIED",
            "ExecutionSummary": {
                "ExecutionTime": 1550508475.0
            },
            "Details": {
                "DocumentName": "AWS-UpdateSSMAgent",
                "DocumentVersion": "1"
            }
        }
    ]
}

For more information, see Learn details about Compliance in the AWS Systems Manager User Guide.

Options

5 in the AWS CLI reference
--filtersOne or more compliance filters.
--max-resultsThe maximum number of items to return for this call.
--next-tokenA token to start the list.
--resource-idsThe ID for the resources from which to get compliance information.
--resource-typesThe type of resource from which to get compliance information.