AWS Command Line Interface
User Guide

Understanding Return Codes from the AWS CLI

To determine the return code of an AWS CLI command, run one of the following commands immediately after running the CLI command.

Linux/Unix/Mac systems

$ echo $?

Windows PowerShell

PS> echo $lastexitcode

Windows Command Prompt

C:\> echo %errorlevel%

The following are the return code values that can be returned at the end of running an AWS Command Line Interface (AWS CLI) command.

Code Meaning
0 The command completed successfully. There were no errors generated by either the AWS CLI or by the AWS service to which the request was sent.
1 One or more S3 transfer operations failed. Limited to s3 commands.
2

The meaning of this return code depends on the command.

  • The command entered on the command line couldn't be parsed. Parsing failures can be caused by, but aren't limited to, missing required subcommands or arguments, or using unknown commands or arguments.

    Applicable to all CLI commands.

  • One or more files marked for transfer were skipped during the transfer process. However, all other files marked for transfer were successfully transferred. Files that are skipped during the transfer process include: files that do not exist, files that are character special devices, block special device, FIFO's, or sockets, and files that the user doesn't have read permissions to.

    Limited to S3 commands.

130 The command was interrupted by a SIGINT (Ctrl-C).
255 The command failed. There were errors generated by either the AWS CLI or by the AWS service to which the request was sent.

To learn more details about a failure, run the command with the --debug switch. This produces a detailed report of the steps the AWS CLI uses to process the command, and what the result of each step was.