[ aws . ssm ]

list-associations

Description

Returns all State Manager associations in the current AWS account and Region. You can limit the results to a specific State Manager association document or instance by specifying a filter.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

list-associations is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the --no-paginate argument. When using --output text and the --query argument on a paginated response, the --query argument must extract data from the results of the following query expressions: Associations

Synopsis

  list-associations
[--association-filter-list <value>]
[--cli-input-json | --cli-input-yaml]
[--starting-token <value>]
[--page-size <value>]
[--max-items <value>]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <value>]

Options

--association-filter-list (list)

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

(structure)

Describes a filter.

key -> (string)

The name of the filter.

value -> (string)

The filter value.

Shorthand Syntax:

key=string,value=string ...

JSON Syntax:

[
  {
    "key": "InstanceId"|"Name"|"AssociationId"|"AssociationStatusName"|"LastExecutedBefore"|"LastExecutedAfter"|"AssociationName"|"ResourceGroupName",
    "value": "string"
  }
  ...
]

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--starting-token (string)

A token to specify where to start paginating. This is the NextToken from a previously truncated response.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--page-size (integer)

The size of each page to get in the AWS service call. This does not affect the number of items returned in the command’s output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--max-items (integer)

The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a NextToken is provided in the command’s output. To resume pagination, provide the NextToken value in the starting-token argument of a subsequent command. Do not use the NextToken response element directly outside of the AWS CLI.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

Examples

To list your associations for a specific instance

This example lists all the associations for an instance.

Command:

aws ssm list-associations --association-filter-list "key=InstanceId,value=i-1234567890abcdef0"

Output:

{
  "Associations": [
      {
          "Name": "AWS-UpdateSSMAgent",
          "InstanceId": "i-1234567890abcdef0",
          "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab",
          "AssociationVersion": "1",
          "Targets": [
              {
                  "Key": "InstanceIds",
                  "Values": [
                      "i-016648b75dd622dab"
                  ]
              }
          ],
          "Overview": {
              "Status": "Pending",
              "DetailedStatus": "Associated",
              "AssociationStatusAggregatedCount": {
                  "Pending": 1
              }
          },
          "ScheduleExpression": "cron(0 00 12 ? * SUN *)",
          "AssociationName": "UpdateSSMAgent"
      }
  ]
}

To list your associations for a specific document

This example lists all associations for the specified document.

Command:

aws ssm list-associations --association-filter-list "key=Name,value=AWS-UpdateSSMAgent"

Output:

{
  "Associations": [
      {
          "Name": "AWS-UpdateSSMAgent",
                      "InstanceId": "i-1234567890abcdef0",
          "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab",
          "AssociationVersion": "1",
          "Targets": [
              {
                  "Key": "InstanceIds",
                  "Values": [
                      "i-1234567890abcdef0"
                  ]
              }
          ],
          "LastExecutionDate": 1550505828.548,
          "Overview": {
              "Status": "Success",
              "DetailedStatus": "Success",
              "AssociationStatusAggregatedCount": {
                  "Success": 1
              }
          },
          "ScheduleExpression": "cron(0 00 12 ? * SUN *)",
          "AssociationName": "UpdateSSMAgent"
      },
              {
          "Name": "AWS-UpdateSSMAgent",
          "InstanceId": "i-9876543210abcdef0",
          "AssociationId": "fbc07ef7-b985-4684-b82b-0123456789ab",
          "AssociationVersion": "1",
          "Targets": [
              {
                  "Key": "InstanceIds",
                  "Values": [
                      "i-9876543210abcdef0"
                  ]
              }
          ],
          "LastExecutionDate": 1550507531.0,
          "Overview": {
              "Status": "Success",
              "AssociationStatusAggregatedCount": {
                  "Success": 1
              }
          }
      }
  ]
}

Output

Associations -> (list)

The associations.

(structure)

Describes an association of a Systems Manager document and an instance.

Name -> (string)

The name of the Systems Manager document.

InstanceId -> (string)

The ID of the instance.

AssociationId -> (string)

The ID created by the system when you create an association. An association is a binding between a document and a set of targets with a schedule.

AssociationVersion -> (string)

The association version.

DocumentVersion -> (string)

The version of the document used in the association.

Targets -> (list)

The instances targeted by the request to create an association.

(structure)

An array of search criteria that targets instances using a Key,Value combination that you specify.

Supported formats include the following.

  • ``Key=InstanceIds,Values=*instance-id-1* ,*instance-id-2* ,*instance-id-3* ``

  • ``Key=tag:my-tag-key ,Values=*my-tag-value-1* ,*my-tag-value-2* ``

  • ``Key=tag-key,Values=*my-tag-key-1* ,*my-tag-key-2* ``

  • (Maintenance window targets only) ``Key=resource-groups:Name,Values=*resource-group-name* ``

  • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*resource-type-1* ,*resource-type-2* ``

For example:

  • Key=InstanceIds,Values=i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE,i-07782c72faEXAMPLE

  • Key=tag:CostCenter,Values=CostCenter1,CostCenter2,CostCenter3

  • Key=tag-key,Values=Name,Instance-Type,CostCenter

  • (Maintenance window targets only) Key=resource-groups:Name,Values=ProductionResourceGroup This example demonstrates how to target all resources in the resource group ProductionResourceGroup in your maintenance window.

  • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*AWS::EC2::INSTANCE* ,*AWS::EC2::VPC* `` This example demonstrates how to target only EC2 instances and VPCs in your maintenance window.

  • (State Manager association targets only) Key=InstanceIds,Values=* This example demonstrates how to target all managed instances in the AWS Region where the association was created.

For information about how to send commands that target instances using Key,Value parameters, see Targeting multiple instances in the AWS Systems Manager User Guide .

Key -> (string)

User-defined criteria for sending commands that target instances that meet the criteria.

Values -> (list)

User-defined criteria that maps to Key . For example, if you specified tag:ServerRole , you could specify value:WebServer to run a command on instances that include EC2 tags of ServerRole,WebServer .

(string)

LastExecutionDate -> (timestamp)

The date on which the association was last run.

Overview -> (structure)

Information about the association.

Status -> (string)

The status of the association. Status can be: Pending, Success, or Failed.

DetailedStatus -> (string)

A detailed status of the association.

AssociationStatusAggregatedCount -> (map)

Returns the number of targets for the association status. For example, if you created an association with two instances, and one of them was successful, this would return the count of instances by status.

key -> (string)

value -> (integer)

ScheduleExpression -> (string)

A cron expression that specifies a schedule when the association runs.

AssociationName -> (string)

The association name.

NextToken -> (string)

The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.