[ aws . ssm ]

start-change-request-execution

Description

Creates a change request for Change Manager. The Automation runbooks specified in the change request run only after all required approvals for the change request have been received.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  start-change-request-execution
[--scheduled-time <value>]
--document-name <value>
[--document-version <value>]
[--parameters <value>]
[--change-request-name <value>]
[--client-token <value>]
[--auto-approve | --no-auto-approve]
--runbooks <value>
[--tags <value>]
[--scheduled-end-time <value>]
[--change-details <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

--scheduled-time (timestamp)

The date and time specified in the change request to run the Automation runbooks.

Note

The Automation runbooks specified for the runbook workflow can’t run until all required approvals for the change request have been received.

--document-name (string)

The name of the change template document to run during the runbook workflow.

--document-version (string)

The version of the change template document to run during the runbook workflow.

--parameters (map)

A key-value map of parameters that match the declared parameters in the change template document.

key -> (string)

value -> (list)

(string)

Shorthand Syntax:

KeyName1=string,string,KeyName2=string,string

JSON Syntax:

{"string": ["string", ...]
  ...}

--change-request-name (string)

The name of the change request associated with the runbook workflow to be run.

--client-token (string)

The user-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, and can’t be reused.

--auto-approve | --no-auto-approve (boolean)

Indicates whether the change request can be approved automatically without the need for manual approvals.

If AutoApprovable is enabled in a change template, then setting AutoApprove to true in StartChangeRequestExecution creates a change request that bypasses approver review.

Note

Change Calendar restrictions are not bypassed in this scenario. If the state of an associated calendar is CLOSED , change freeze approvers must still grant permission for this change request to run. If they don’t, the change won’t be processed until the calendar state is again OPEN .

--runbooks (list)

Information about the Automation runbooks that are run during the runbook workflow.

Note

The Automation runbooks specified for the runbook workflow can’t run until all required approvals for the change request have been received.

(structure)

Information about an Automation runbook used in a runbook workflow in Change Manager.

Note

The Automation runbooks specified for the runbook workflow can’t run until all required approvals for the change request have been received.

DocumentName -> (string)

The name of the Automation runbook used in a runbook workflow.

DocumentVersion -> (string)

The version of the Automation runbook used in a runbook workflow.

Parameters -> (map)

The key-value map of execution parameters, which were supplied when calling StartChangeRequestExecution .

key -> (string)

value -> (list)

(string)

TargetParameterName -> (string)

The name of the parameter used as the target resource for the rate-controlled runbook workflow. Required if you specify Targets .

Targets -> (list)

A key-value mapping to target resources that the runbook operation performs tasks on. Required if you specify TargetParameterName .

(structure)

An array of search criteria that targets managed nodes using a key-value pair that you specify.

Note

One or more targets must be specified for maintenance window Run Command-type tasks. Depending on the task, targets are optional for other maintenance window task types (Automation, Lambda, and Step Functions). For more information about running tasks that don’t specify targets, see Registering maintenance window tasks without targets in the Amazon Web Services Systems Manager User Guide .

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>

  • Run Command and 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>

  • Automation targets only : Key=ResourceGroup;Values=<resource-group-name>

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

  • Run Command and 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 Amazon Elastic Compute Cloud (Amazon EC2) instances and VPCs in your maintenance window.

  • Automation targets only : Key=ResourceGroup,Values=MyResourceGroup

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

For more information about how to send commands that target managed nodes using Key,Value parameters, see Targeting multiple instances in the Amazon Web Services Systems Manager User Guide .

Key -> (string)

User-defined criteria for sending commands that target managed nodes 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 .

Depending on the type of target, the maximum number of values for a key might be lower than the global maximum of 50.

(string)

TargetMaps -> (list)

A key-value mapping of runbook parameters to target resources. Both Targets and TargetMaps can’t be specified together.

(map)

key -> (string)

value -> (list)

(string)

MaxConcurrency -> (string)

The MaxConcurrency value specified by the user when the operation started, indicating the maximum number of resources that the runbook operation can run on at the same time.

MaxErrors -> (string)

The MaxErrors value specified by the user when the execution started, indicating the maximum number of errors that can occur during the operation before the updates are stopped or rolled back.

TargetLocations -> (list)

Information about the Amazon Web Services Regions and Amazon Web Services accounts targeted by the current Runbook operation.

(structure)

The combination of Amazon Web Services Regions and Amazon Web Services accounts targeted by the current Automation execution.

Accounts -> (list)

The Amazon Web Services accounts targeted by the current Automation execution.

(string)

Regions -> (list)

The Amazon Web Services Regions targeted by the current Automation execution.

(string)

TargetLocationMaxConcurrency -> (string)

The maximum number of Amazon Web Services Regions and Amazon Web Services accounts allowed to run the Automation concurrently.

TargetLocationMaxErrors -> (string)

The maximum number of errors allowed before the system stops queueing additional Automation executions for the currently running Automation.

ExecutionRoleName -> (string)

The Automation execution role used by the currently running Automation. If not specified, the default value is AWS-SystemsManager-AutomationExecutionRole .

JSON Syntax:

[
  {
    "DocumentName": "string",
    "DocumentVersion": "string",
    "Parameters": {"string": ["string", ...]
      ...},
    "TargetParameterName": "string",
    "Targets": [
      {
        "Key": "string",
        "Values": ["string", ...]
      }
      ...
    ],
    "TargetMaps": [
      {"string": ["string", ...]
        ...}
      ...
    ],
    "MaxConcurrency": "string",
    "MaxErrors": "string",
    "TargetLocations": [
      {
        "Accounts": ["string", ...],
        "Regions": ["string", ...],
        "TargetLocationMaxConcurrency": "string",
        "TargetLocationMaxErrors": "string",
        "ExecutionRoleName": "string"
      }
      ...
    ]
  }
  ...
]

--tags (list)

Optional metadata that you assign to a resource. You can specify a maximum of five tags for a change request. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a change request to identify an environment or target Amazon Web Services Region. In this case, you could specify the following key-value pairs:

  • Key=Environment,Value=Production

  • Key=Region,Value=us-east-2

(structure)

Metadata that you assign to your Amazon Web Services resources. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment. In Amazon Web Services Systems Manager, you can apply tags to Systems Manager documents (SSM documents), managed nodes, maintenance windows, parameters, patch baselines, OpsItems, and OpsMetadata.

Key -> (string)

The name of the tag.

Value -> (string)

The value of the tag.

Shorthand Syntax:

Key=string,Value=string ...

JSON Syntax:

[
  {
    "Key": "string",
    "Value": "string"
  }
  ...
]

--scheduled-end-time (timestamp)

The time that the requester expects the runbook workflow related to the change request to complete. The time is an estimate only that the requester provides for reviewers.

--change-details (string)

User-provided details about the change. If no details are provided, content specified in the Template information section of the associated change template is added.

--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.

--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. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.

See ‘aws help’ for descriptions of global parameters.

Examples

Note

To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .

Example 1: To start a change request

The following start-change-request-execution example starts a change request with minimal options specified.

aws ssm start-change-request-execution \
    --change-request-name MyChangeRequest \
    --document-name AWS-HelloWorldChangeTemplate \
    --runbooks '[{"DocumentName": "AWS-HelloWorld","Parameters": {"AutomationAssumeRole": ["arn:aws:iam:us-east-2:1112223233444:role/MyChangeManagerAssumeRole"]}}]' \
    --parameters Approver="JohnDoe",ApproverType="IamUser",ApproverSnsTopicArn="arn:aws:sns:us-east-2:1112223233444:MyNotificationTopic"

Output:

{
  "AutomationExecutionId": "9d32a4fc-f944-11e6-4105-0a1b2EXAMPLE"
}

Example 2: To start a change request using an external JSON file

The following start-automation-execution example starts a change request with multiple options specified in a JSON file.

aws ssm start-change-request-execution \
    --cli-input-json file://MyChangeRequest.json

Contents of MyChangeRequest.json:

{
    "ChangeRequestName": "MyChangeRequest",
    "DocumentName": "AWS-HelloWorldChangeTemplate",
    "DocumentVersion": "$DEFAULT",
    "ScheduledTime": "2021-12-30T03:00:00",
    "ScheduledEndTime": "2021-12-30T03:05:00",
    "Tags": [
        {
            "Key": "Purpose",
            "Value": "Testing"
        }
    ],
    "Parameters": {
        "Approver": [
            "JohnDoe"
        ],
        "ApproverType": [
            "IamUser"
        ],
        "ApproverSnsTopicArn": [
            "arn:aws:sns:us-east-2:111222333444;:MyNotificationTopic
        ]
    },
    "Runbooks": [
        {
            "DocumentName": "AWS-HelloWorld",
            "DocumentVersion": "1",
            "MaxConcurrency": "1",
            "MaxErrors": "1",
            "Parameters": {
                "AutomationAssumeRole": [
                    "arn:aws:iam::111222333444:role/MyChangeManagerAssumeRole"
                ]
            }
        }
    ],
    "ChangeDetails": "### Document Name: HelloWorldChangeTemplate\n\n## What does this document do?\nThis change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation document called AWS-HelloWorld.\n\n## Input Parameters\n* ApproverSnsTopicArn: (Required) Amazon Simple Notification Service ARN for approvers.\n* Approver: (Required) The name of the approver to send this request to.\n* ApproverType: (Required) The type of reviewer.\n  * Allowed Values: IamUser, IamGroup, IamRole, SSOGroup, SSOUser\n\n## Output Parameters\nThis document has no outputs \n"
}

Output:

{
  "AutomationExecutionId": "9d32a4fc-f944-11e6-4105-0a1b2EXAMPLE"
}

For more information, see Creating change requests in the AWS Systems Manager User Guide.

Output

AutomationExecutionId -> (string)

The unique ID of a runbook workflow operation. (A runbook workflow is a type of Automation operation.)