Cancelling 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 in the EC2 console
Open the Amazon EC2 console and choose Commands 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.

