AWS Developer Tools Blog

Announcing new output formats in AWS CLI v2

Amazon Web Services (AWS) is announcing two new features for the AWS Command Line Interface (AWS CLI) v2: structured error output and the “off” output format.

Structured error output

Errors returned from AWS service APIs often include useful details beyond the code and message—bucket names, validation reasons, resource IDs—that were previously hidden unless you used --debug. Now, you can see this error information directly in your error output.

Starting with AWS CLI v2 version 2.34.0, any additional error details returned from service APIs will now be shown in the stderr output. Additionally, you can configure the AWS CLI to output your errors in alternative structured formats. Control how errors are displayed using the new --cli-error-format CLI flag, the cli_error_format configuration setting, or the AWS_CLI_ERROR_FORMAT environment variable.

Supported formats for the error format parameter:

  • enhanced (default) – Error message with additional details displayed inline
  • json – JSON structure with all error fields
  • yaml – YAML structure with all error fields
  • text – Tab-delimited error fields
  • table – ASCII table format
  • legacy – Original error format

Accessibility enhancements

Since September 2025, AWS CLI errors started including the aws: [ERROR]: prefix for some exceptions. This prefix signals that an error has occurred and supports accessibility best practices and automation use cases. This release ensures the prefix is consistently included for all errors in the enhanced and legacy formats.

Example: Using enhanced output error format

$ aws s3api get-object \
    --bucket amzn-s3-demo-bucket \
    --key file.txt out.txt \
    --cli-error-format enhanced

aws: [ERROR]: An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist

Additional error details:

BucketName: amzn-s3-demo-bucket

Example: Using json output error format

$ aws s3api get-object \
    --bucket amzn-s3-demo-bucket \
    --key file.txt out.txt \
    --cli-error-format json
{
  "Code": "NoSuchBucket",
  "Message": "The specified bucket does not exist",
  "BucketName": "amzn-s3-demo-bucket"
}

Example: Using legacy output error format

$ aws s3api get-object \
    --bucket amzn-s3-demo-bucket \
    --key file.txt out.txt \
    --cli-error-format legacy

aws: [ERROR]: An error occurred (NoSuchBucket) when calling the GetObject operation: The specified bucket does not exist

Turning off CLI output

Sometimes, you might want to hide the AWS CLI command output, such as when using a command that may output sensitive information. The off format suppresses stdout while still preserving errors on stderr.

For example, you can create an AWS Secrets Manager secret without writing the secret ARN or version information to logs:

$ aws secretsmanager create-secret \
    --name my-secret \
    --secret-string "password123" \
    --output off
$ echo $?
0

You can set this using the--output off CLI flag, setting output = off in your configuration file, or the AWS_DEFAULT_OUTPUT=off environment variable.

Next Steps

To take advantage of these new output features, upgrade your version of the AWS CLI to 2.34.0. For more information, see the Structured error output and Output format guides. Please share your questions, comments, and issues with us on GitHub.

Andrew Asseily

Andrew Asseily

Andrew is a Software Development Engineer on the AWS CLI team. Outside of work, he's an avid Brazilian Jiu-Jitsu practitioner.