Updating the Amazon SSM Agent Using Amazon EC2 Run Command
You can use the AWS-UpdateSSMAgent document to update the Amazon SSM agent running on your instances. You can update to either the latest version or downgrade to an older version. When you execute the command, the system downloads the version from AWS, installs it, and then uninstalls the version that existed before the command was run. If an error occurs during this process, the system rolls back to the version on the server before the command was run and the command status shows that the command failed.
Note
This procedure does not include information about how to configure Run Command for Amazon SNS notifications. To learn more about the Amazon SNS notification fields on the Command History page and how to execute commands that return notifications, see Getting Amazon SNS Notifications When a Command Changes Status.
To update the Amazon SSM Agent using Run Command
Open the Amazon EC2 console and choose Command History in the navigation pane.
Choose Run a Command.
In the Command document list, choose AWS-UpdateSSMAgent.
Choose Select target instances to select the instances where you want the command to run. If you do not see a complete list of instances, the missing instances might not be configured properly for Run Command. For more information, see Amazon EC2 Run Command Prerequisites.
(Optional) In the Version field, type a specific version of the Amazon SSM agent to install. You can install older versions of the agent. If you do not specify a version, the service will be updated to the latest version.
(Optional) In the Allow downgrade list, choose True if you want to install an earlier version of the Amazon SSM agent. If you choose this option, you must specify the earlier version number. Choose False if you want the system to install only the newest version of the service.
(Optional) In the Comment field, type information you want to provide about this command. Comments are stored in the log file and appear in the Command Invocation List in the Amazon EC2 console.
Tip
We recommend that you enter specific comments about each command you run. The list of commands that you send can grow quickly, and the Comment field can help you identify commands that you want to monitor.
In the Timeout (seconds) field, type the number of seconds Run Command should attempt to reach instances before an instance is considered unreachable and the command execution fails. The minimum is 30 seconds. The maximum is 30 days. The default value is 10 minutes.
In the S3 bucket field type the name of an Amazon S3 bucket where you want to store the output of the command.
Important
The Run Command Output page in the Amazon EC2 console truncates output after 2500 characters. Configure an Amazon S3 bucket before executing commands using Run Command. If your command output was longer than 2500 characters, you can view the full output in your Amazon S3 bucket. For more information, see Create a Bucket.
In the S3 key prefix, field enter the name of a subfolder in the Amazon S3 bucket. This subfolder can help you organize Run Command output.
Note
The section called AWS Command Line Interface command displays a usable CLI script that is generated based on the parameters you entered.
After you execute a command using Run Command, the system returns you to the commands list.
Important
The Amazon EC2 console truncates all command output beyond 2500 characters. If your command output was longer than 2500 characters, you can view the full output in your S3 bucket.
Canceling a Command
You can attempt to cancel a command as long as the service shows that it is in either a Pending or Executing state. However, even if a command is still in one of these states, we cannot guarantee that the command will be terminated and the underlying process stopped.
To cancel a command using the console
Open the Amazon EC2 console and choose Command History in the navigation pane.
Select the command invocation that you want to cancel.
Choose Actions and then choose Cancel command.
To cancel a command using the AWS CLI
Use the following command.
aws ssm cancel-command --command-id "command ID" --instance-ids "instance ID"For information about the status of a cancelled command, see Monitoring Commands.
View Command Output
Use the following procedure to view the results of command execution in the EC2 console.
To view command output
In the Amazon EC2 console, select a command in the list.
Choose the Output tab.
Choose View Output.

The command output page shows the results of your command execution.

For information about how to run commands using the AWS CLI, see the SSM CLI Reference.

