0
0
AWScloud~5 mins

CLI output formats (json, table, text) in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
When you use the AWS command line, you can choose how the results show up. This helps you read the information better or use it in other programs.
When you want to see AWS resource details in a simple list format for quick reading.
When you need to get AWS data in JSON to use it in scripts or programs.
When you prefer a clean table view to compare multiple resources side by side.
When you want to save AWS command output in a file for later use.
When you want to switch between formats depending on the task, like debugging or automation.
Commands
This command lists your S3 buckets and shows the output in JSON format, which is easy for programs to read.
Terminal
aws s3api list-buckets --output json
Expected OutputExpected
{"Buckets":[{"CreationDate":"2023-01-01T12:00:00.000Z","Name":"example-bucket"}]}
--output - Sets the format of the command output.
This command lists your S3 buckets and shows the output in a neat table format for easy reading.
Terminal
aws s3api list-buckets --output table
Expected OutputExpected
------------------------- | ListBuckets | +-----------------------+ | CreationDate | | 2023-01-01T12:00:00Z | | Name | | example-bucket | +-----------------------+
--output - Sets the format of the command output.
This command lists your S3 buckets and shows the output in plain text format, which is simple and easy to read.
Terminal
aws s3api list-buckets --output text
Expected OutputExpected
BUCKETS example-bucket 2023-01-01T12:00:00Z
--output - Sets the format of the command output.
Key Concept

If you remember nothing else from this pattern, remember: use the --output flag to choose how AWS CLI shows your data, making it easier to read or use.

Common Mistakes
Not using the --output flag and getting default output that is hard to read or parse.
The default output may not fit your needs for readability or automation.
Always specify --output json, table, or text depending on your goal.
Using JSON output but trying to read it directly without a tool or script.
JSON is structured for programs, not easy for humans to read raw.
Use JSON output when you plan to process the data with scripts or tools.
Summary
Use the --output flag to control how AWS CLI shows command results.
JSON output is best for automation and scripts.
Table and text outputs are easier for humans to read quickly.