Amazon Simple Systems Management Service

2016/07/19 - Amazon Simple Systems Management Service - 3 updated api methods

Changes  Adds notification support.

ListCommandInvocations (updated) Link ¶
Changes (response)
{'CommandInvocations': {'NotificationConfig': {'NotificationArn': 'string',
                                               'NotificationEvents': ['All | '
                                                                      'InProgress '
                                                                      '| '
                                                                      'Success '
                                                                      '| '
                                                                      'TimedOut '
                                                                      '| '
                                                                      'Cancelled '
                                                                      '| '
                                                                      'Failed'],
                                               'NotificationType': 'Command | '
                                                                   'Invocation'},
                        'ServiceRole': 'string'}}

An invocation is copy of a command sent to a specific instance. A command can apply to one or more instances. A command invocation applies to one instance. For example, if a user executes SendCommand against three instances, then a command invocation is created for each requested instance ID. ListCommandInvocations provide status about command execution.

Request Syntax

client.list_command_invocations(
    CommandId='string',
    InstanceId='string',
    MaxResults=123,
    NextToken='string',
    Filters=[
        {
            'key': 'InvokedAfter'|'InvokedBefore'|'Status',
            'value': 'string'
        },
    ],
    Details=True|False
)
type CommandId

string

param CommandId

(Optional) The invocations for a specific command ID.

type InstanceId

string

param InstanceId

(Optional) The command execution details for a specific instance ID.

type MaxResults

integer

param MaxResults

(Optional) The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

(Optional) The token for the next set of items to return. (You received this token from a previous call.)

type Filters

list

param Filters

(Optional) One or more filters. Use a filter to return a more specific list of results.

  • (dict) --

    Describes a command filter.

    • key (string) -- [REQUIRED]

      The name of the filter. For example, requested date and time.

    • value (string) -- [REQUIRED]

      The filter value. For example: June 30, 2015.

type Details

boolean

param Details

(Optional) If set this returns the response of the command executions and any command output. By default this is set to False.

rtype

dict

returns

Response Syntax

{
    'CommandInvocations': [
        {
            'CommandId': 'string',
            'InstanceId': 'string',
            'Comment': 'string',
            'DocumentName': 'string',
            'RequestedDateTime': datetime(2015, 1, 1),
            'Status': 'Pending'|'InProgress'|'Cancelling'|'Success'|'TimedOut'|'Cancelled'|'Failed',
            'TraceOutput': 'string',
            'CommandPlugins': [
                {
                    'Name': 'string',
                    'Status': 'Pending'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
                    'ResponseCode': 123,
                    'ResponseStartDateTime': datetime(2015, 1, 1),
                    'ResponseFinishDateTime': datetime(2015, 1, 1),
                    'Output': 'string',
                    'OutputS3BucketName': 'string',
                    'OutputS3KeyPrefix': 'string'
                },
            ],
            'ServiceRole': 'string',
            'NotificationConfig': {
                'NotificationArn': 'string',
                'NotificationEvents': [
                    'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
                ],
                'NotificationType': 'Command'|'Invocation'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CommandInvocations (list) --

      (Optional) A list of all invocations.

      • (dict) --

        An invocation is copy of a command sent to a specific instance. A command can apply to one or more instances. A command invocation applies to one instance. For example, if a user executes SendCommand against three instances, then a command invocation is created for each requested instance ID. A command invocation returns status and detail information about a command you executed.

        • CommandId (string) --

          The command against which this invocation was requested.

        • InstanceId (string) --

          The instance ID in which this invocation was requested.

        • Comment (string) --

          User-specified information about the command, such as a brief description of what the command should do.

        • DocumentName (string) --

          The document name that was requested for execution.

        • RequestedDateTime (datetime) --

          The time and date the request was sent to this instance.

        • Status (string) --

          Whether or not the invocation succeeded, failed, or is pending.

        • TraceOutput (string) --

          Gets the trace output sent by the agent.

        • CommandPlugins (list) --

          • (dict) --

            Describes plugin details.

            • Name (string) --

              The name of the plugin. Must be one of the following: aws:updateAgent, aws:domainjoin, aws:applications, aws:runPowerShellScript, aws:psmodule, aws:cloudWatch, aws:runShellScript, or aws:updateSSMAgent.

            • Status (string) --

              The status of this plugin. You can execute a document with multiple plugins.

            • ResponseCode (integer) --

              A numeric response code generated after executing the plugin.

            • ResponseStartDateTime (datetime) --

              The time the plugin started executing.

            • ResponseFinishDateTime (datetime) --

              The time the plugin stopped executing. Could stop prematurely if, for example, a cancel command was sent.

            • Output (string) --

              Output of the plugin execution.

            • OutputS3BucketName (string) --

              The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command.

            • OutputS3KeyPrefix (string) --

              The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command.

        • ServiceRole (string) --

          The IAM service role that SSM uses to act on your behalf when sending notifications about command status changes on a per instance basis.

        • NotificationConfig (dict) --

          Configurations for sending notifications about command status changes on a per instance basis.

          • NotificationArn (string) --

            An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. SSM pushes notifications about command status changes to this topic.

          • NotificationEvents (list) --

            The different events for which you can receive notifications. These events include the following: All (events), InProgress, Success, TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User Guide .

            • (string) --

          • NotificationType (string) --

            Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.

    • NextToken (string) --

      (Optional) The token for the next set of items to return. (You received this token from a previous call.)

ListCommands (updated) Link ¶
Changes (response)
{'Commands': {'NotificationConfig': {'NotificationArn': 'string',
                                     'NotificationEvents': ['All | InProgress '
                                                            '| Success | '
                                                            'TimedOut | '
                                                            'Cancelled | '
                                                            'Failed'],
                                     'NotificationType': 'Command | '
                                                         'Invocation'},
              'ServiceRole': 'string'}}

Lists the commands requested by users of the AWS account.

Request Syntax

client.list_commands(
    CommandId='string',
    InstanceId='string',
    MaxResults=123,
    NextToken='string',
    Filters=[
        {
            'key': 'InvokedAfter'|'InvokedBefore'|'Status',
            'value': 'string'
        },
    ]
)
type CommandId

string

param CommandId

(Optional) If provided, lists only the specified command.

type InstanceId

string

param InstanceId

(Optional) Lists commands issued against this instance ID.

type MaxResults

integer

param MaxResults

(Optional) The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

(Optional) The token for the next set of items to return. (You received this token from a previous call.)

type Filters

list

param Filters

(Optional) One or more filters. Use a filter to return a more specific list of results.

  • (dict) --

    Describes a command filter.

    • key (string) -- [REQUIRED]

      The name of the filter. For example, requested date and time.

    • value (string) -- [REQUIRED]

      The filter value. For example: June 30, 2015.

rtype

dict

returns

Response Syntax

{
    'Commands': [
        {
            'CommandId': 'string',
            'DocumentName': 'string',
            'Comment': 'string',
            'ExpiresAfter': datetime(2015, 1, 1),
            'Parameters': {
                'string': [
                    'string',
                ]
            },
            'InstanceIds': [
                'string',
            ],
            'RequestedDateTime': datetime(2015, 1, 1),
            'Status': 'Pending'|'InProgress'|'Cancelling'|'Success'|'TimedOut'|'Cancelled'|'Failed',
            'OutputS3BucketName': 'string',
            'OutputS3KeyPrefix': 'string',
            'ServiceRole': 'string',
            'NotificationConfig': {
                'NotificationArn': 'string',
                'NotificationEvents': [
                    'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
                ],
                'NotificationType': 'Command'|'Invocation'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Commands (list) --

      (Optional) The list of commands requested by the user.

      • (dict) --

        Describes a command request.

        • CommandId (string) --

          A unique identifier for this command.

        • DocumentName (string) --

          The name of the SSM document requested for execution.

        • Comment (string) --

          User-specified information about the command, such as a brief description of what the command should do.

        • ExpiresAfter (datetime) --

          If this time is reached and the command has not already started executing, it will not execute. Calculated based on the ExpiresAfter user input provided as part of the SendCommand API.

        • Parameters (dict) --

          The parameter values to be inserted in the SSM document when executing the command.

          • (string) --

            • (list) --

              • (string) --

        • InstanceIds (list) --

          The instance IDs against which this command was requested.

          • (string) --

        • RequestedDateTime (datetime) --

          The date and time the command was requested.

        • Status (string) --

          The status of the command.

        • OutputS3BucketName (string) --

          The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command.

        • OutputS3KeyPrefix (string) --

          The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command.

        • ServiceRole (string) --

          The IAM service role that SSM uses to act on your behalf when sending notifications about command status changes.

        • NotificationConfig (dict) --

          Configurations for sending notifications about command status changes.

          • NotificationArn (string) --

            An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. SSM pushes notifications about command status changes to this topic.

          • NotificationEvents (list) --

            The different events for which you can receive notifications. These events include the following: All (events), InProgress, Success, TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User Guide .

            • (string) --

          • NotificationType (string) --

            Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.

    • NextToken (string) --

      (Optional) The token for the next set of items to return. (You received this token from a previous call.)

SendCommand (updated) Link ¶
Changes (request, response)
Request
{'NotificationConfig': {'NotificationArn': 'string',
                        'NotificationEvents': ['All | InProgress | Success | '
                                               'TimedOut | Cancelled | Failed'],
                        'NotificationType': 'Command | Invocation'},
 'ServiceRoleArn': 'string'}
Response
{'Command': {'NotificationConfig': {'NotificationArn': 'string',
                                    'NotificationEvents': ['All | InProgress | '
                                                           'Success | TimedOut '
                                                           '| Cancelled | '
                                                           'Failed'],
                                    'NotificationType': 'Command | Invocation'},
             'ServiceRole': 'string'}}

Executes commands on one or more remote instances.

Request Syntax

client.send_command(
    InstanceIds=[
        'string',
    ],
    DocumentName='string',
    DocumentHash='string',
    DocumentHashType='Sha256'|'Sha1',
    TimeoutSeconds=123,
    Comment='string',
    Parameters={
        'string': [
            'string',
        ]
    },
    OutputS3BucketName='string',
    OutputS3KeyPrefix='string',
    ServiceRoleArn='string',
    NotificationConfig={
        'NotificationArn': 'string',
        'NotificationEvents': [
            'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
        ],
        'NotificationType': 'Command'|'Invocation'
    }
)
type InstanceIds

list

param InstanceIds

[REQUIRED]

Required. The instance IDs where the command should execute. You can specify a maximum of 50 IDs.

  • (string) --

type DocumentName

string

param DocumentName

[REQUIRED]

Required. The name of the SSM document to execute. This can be an SSM public document or a custom document.

type DocumentHash

string

param DocumentHash

The Sha256 or Sha1 hash created by the system when the document was created.

Note

Sha1 hashes have been deprecated.

type DocumentHashType

string

param DocumentHashType

Sha256 or Sha1.

Note

Sha1 hashes have been deprecated.

type TimeoutSeconds

integer

param TimeoutSeconds

If this time is reached and the command has not already started executing, it will not execute.

type Comment

string

param Comment

User-specified information about the command, such as a brief description of what the command should do.

type Parameters

dict

param Parameters

The required and optional parameters specified in the SSM document being executed.

  • (string) --

    • (list) --

      • (string) --

type OutputS3BucketName

string

param OutputS3BucketName

The name of the S3 bucket where command execution responses should be stored.

type OutputS3KeyPrefix

string

param OutputS3KeyPrefix

The directory structure within the S3 bucket where the responses should be stored.

type ServiceRoleArn

string

param ServiceRoleArn

The IAM role that SSM uses to send notifications.

type NotificationConfig

dict

param NotificationConfig

Configurations for sending notifications.

  • NotificationArn (string) --

    An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. SSM pushes notifications about command status changes to this topic.

  • NotificationEvents (list) --

    The different events for which you can receive notifications. These events include the following: All (events), InProgress, Success, TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User Guide .

    • (string) --

  • NotificationType (string) --

    Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.

rtype

dict

returns

Response Syntax

{
    'Command': {
        'CommandId': 'string',
        'DocumentName': 'string',
        'Comment': 'string',
        'ExpiresAfter': datetime(2015, 1, 1),
        'Parameters': {
            'string': [
                'string',
            ]
        },
        'InstanceIds': [
            'string',
        ],
        'RequestedDateTime': datetime(2015, 1, 1),
        'Status': 'Pending'|'InProgress'|'Cancelling'|'Success'|'TimedOut'|'Cancelled'|'Failed',
        'OutputS3BucketName': 'string',
        'OutputS3KeyPrefix': 'string',
        'ServiceRole': 'string',
        'NotificationConfig': {
            'NotificationArn': 'string',
            'NotificationEvents': [
                'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
            ],
            'NotificationType': 'Command'|'Invocation'
        }
    }
}

Response Structure

  • (dict) --

    • Command (dict) --

      The request as it was received by SSM. Also provides the command ID which can be used future references to this request.

      • CommandId (string) --

        A unique identifier for this command.

      • DocumentName (string) --

        The name of the SSM document requested for execution.

      • Comment (string) --

        User-specified information about the command, such as a brief description of what the command should do.

      • ExpiresAfter (datetime) --

        If this time is reached and the command has not already started executing, it will not execute. Calculated based on the ExpiresAfter user input provided as part of the SendCommand API.

      • Parameters (dict) --

        The parameter values to be inserted in the SSM document when executing the command.

        • (string) --

          • (list) --

            • (string) --

      • InstanceIds (list) --

        The instance IDs against which this command was requested.

        • (string) --

      • RequestedDateTime (datetime) --

        The date and time the command was requested.

      • Status (string) --

        The status of the command.

      • OutputS3BucketName (string) --

        The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command.

      • OutputS3KeyPrefix (string) --

        The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command.

      • ServiceRole (string) --

        The IAM service role that SSM uses to act on your behalf when sending notifications about command status changes.

      • NotificationConfig (dict) --

        Configurations for sending notifications about command status changes.

        • NotificationArn (string) --

          An Amazon Resource Name (ARN) for a Simple Notification Service (SNS) topic. SSM pushes notifications about command status changes to this topic.

        • NotificationEvents (list) --

          The different events for which you can receive notifications. These events include the following: All (events), InProgress, Success, TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User Guide .

          • (string) --

        • NotificationType (string) --

          Command: Receive notification when the status of a command changes. Invocation: For commands sent to multiple instances, receive notification on a per-instance basis when the status of a command changes.