Available AWS CLI Output Formats

1) JSON (JavaScript Object Notation)

Description: Outputs data in a structured JSON format. This is the default output format and is ideal for scripting and processing with other tools.

aws ec2 describe-instances –output json
Example:
json

{
“Reservations”: [
{
“Instances”: [
{
“InstanceId”: “i-0123456789abcdef0”,
“InstanceType”: “t2.micro”,

}
]
}
]
}

2) YAML (YAML Ain’t Markup Language)

Description: Outputs data in a structured YAML format. YAML is more human-readable than JSON and is often used in configuration files.

aws ec2 describe-instances –output yaml
Example:
yaml

Reservations:

  • Instances:
  • InstanceId: i-0123456789abcdef0
    InstanceType: t2.micro

    3) YAML-STREAM

Description: Outputs data as a stream of YAML documents, one document per line. This format is useful for processing large outputs in a streaming fashion.

aws ec2 describe-instances –output yaml-stream
Example:
yaml

Reservations:
Instances:
– InstanceId: i-0123456789abcdef0
InstanceType: t2.micro

4) TEXT

Description: Outputs data as plain text, organized in tab-separated columns. This format is suitable for quick viewing and simple parsing.

aws ec2 describe-instances –output text
Example:

RESERVATIONS i-0123456789abcdef0 t2.micro …

5) TABLE

Description: Outputs data in a human-readable, column-formatted table. This format is helpful for quickly viewing results in a structured format.

aws ec2 describe-instances –output table

Example:


| DescribeInstances |
+—————————————————————–+
|| Reservations ||
|+———————+—————————————-+|
|| InstanceId | i-0123456789abcdef0 ||
|| InstanceType | t2.micro ||
|| … ||
+—————————————————————-+

Setting the Default Output Format

You can set the default output format during the AWS CLI configuration process or by modifying the ~/.aws/config file:

aws configure

Or manually edit the configuration file:

default output = json

Replace json with yaml, yaml-stream, text, or table to change the default output format.

Per-Command Output Format

To specify the output format for a specific command, use the –output option:

aws s3 ls –output table

This flexibility allows you to tailor the output format to your needs, whether for automation, scripting, or human readability.

Download AWS Configuration Output Instructions