CmdID

CmdID / aws / aws ssm

aws ssm list-commands

Lists the commands requested by users of the Amazon Web Services account. 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 get the status of a specific command

The following list-commands example retrieves and displays the status of the specified command.

aws ssm list-commands --command-id "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"Identify
--command-id(Optional) If provided, lists only the specified command.
Its output, shortened
{
    "Commands": [
        {
            "CommandId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "DocumentName": "AWS-RunShellScript",
            "DocumentVersion": "1",
            "Comment": "",
            "ExpiresAfter": "2020-02-19T12:28:02.500000-08:00",
            "Parameters": {
                "commands": [
                    "ifconfig"
                ]
            },
            "InstanceIds": [
                "i-028ea792daEXAMPLE"
            ],
            "Targets": [],
            "RequestedDateTime": "2020-02-19T11:18:02.500000-08:00",
            "Status": "Success",
            "StatusDetails": "Success",
            "OutputS3BucketName": "",
            "OutputS3KeyPrefix": "",
            "MaxConcurrency": "50",
            "MaxErrors": "0",
            "TargetCount": 1,
            "CompletedCount": 1,
            "ErrorCount": 0,
            "DeliveryTimedOutCount": 0,
            "ServiceRole": "",
            "NotificationConfig": {
… 12 more lines

Example 2: To get the status of commands requested after a specific date

The following list-commands example retrieves the details of commands requested after the specified date.

aws ssm list-commands --filters "key=InvokedAfter,value=2020-02-01T00:00:00Z"Identify
--filters(Optional) One or more filters.
Its output, shortened
{
    "Commands": [
        {
            "CommandId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "DocumentName": "AWS-UpdateSSMAgent",
            "DocumentVersion": "",
            "Comment": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333:a1b2c3d4-5678-90ab-cdef-EXAMPLE44444",
            "ExpiresAfter": "2020-02-19T11:28:02.500000-08:00",
            "Parameters": {},
            "InstanceIds": [
                "i-028ea792daEXAMPLE",
                "i-02feef8c46EXAMPLE",
                "i-038613f3f0EXAMPLE",
                "i-03a530a2d4EXAMPLE",
                "i-083b678d37EXAMPLE",
                "i-0dee81debaEXAMPLE"
            ],
            "Targets": [],
            "RequestedDateTime": "2020-02-19T10:18:02.500000-08:00",
            "Status": "Success",
            "StatusDetails": "Success",
            "OutputS3BucketName": "",
            "OutputS3KeyPrefix": "",
            "MaxConcurrency": "50",
            "MaxErrors": "100%",
            "TargetCount": 6,
            "CompletedCount": 6,
            "ErrorCount": 0,
            "DeliveryTimedOutCount": 0,
            "ServiceRole": "",
… 12 more lines

Example 3: To list all commands requested in an AWS account

The following list-commands example lists all commands requested by users in the current AWS account and Region.

aws ssm list-commandsIdentify
Its output, shortened
{
    "Commands": [
        {
            "CommandId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222",
            "DocumentName": "AWS-UpdateSSMAgent",
            "DocumentVersion": "",
            "Comment": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333:a1b2c3d4-5678-90ab-cdef-EXAMPLE44444",
            "ExpiresAfter": "2020-02-19T11:28:02.500000-08:00",
            "Parameters": {},
            "InstanceIds": [
                "i-028ea792daEXAMPLE",
                "i-02feef8c46EXAMPLE",
                "i-038613f3f0EXAMPLE",
                "i-03a530a2d4EXAMPLE",
                "i-083b678d37EXAMPLE",
                "i-0dee81debaEXAMPLE"
            ],
            "Targets": [],
            "RequestedDateTime": "2020-02-19T10:18:02.500000-08:00",
            "Status": "Success",
            "StatusDetails": "Success",
            "OutputS3BucketName": "",
            "OutputS3KeyPrefix": "",
            "MaxConcurrency": "50",
            "MaxErrors": "100%",
            "TargetCount": 6,
            "CompletedCount": 6,
            "ErrorCount": 0,
            "DeliveryTimedOutCount": 0,
            "ServiceRole": "",
… 114 more lines

For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide.

Options

5 in the AWS CLI reference
--command-id(Optional) If provided, lists only the specified command.
--filters(Optional) One or more filters.
--instance-id(Optional) Lists commands issued against this managed node ID.
--max-results(Optional) The maximum number of items to return for this call.
--next-token(Optional) The token for the next set of items to return.