| by Arround The Web | No comments

How to Customize the AWS CLI Output Format?

AWS is a platform that offers multiple services in the Information Technology or computing domain on the cloud for customers across the globe. Millions of customers are opting for these services using the AWS Management Console, which is the GUI of the platform, however, it also offers the use of AWS CLI commands. Using the AWS CLI command, the users can access and manage AWS service using simple commands on the command prompt and get responses from the platform in different formats.

This guide will explain the process of customizing the AWS CLI formats.

How to Customize the AWS CLI Output Format?

AWS CLI offers multiple formats for getting the output after executing its commands on the Windows terminal. Users can easily set the default output format while configuring the AWS CLI using its IAM user credentials. To learn how to configure AWS CLI, follow this guide and then simply change the output format using the “configure” command in the command prompt:

aws configure

AWS CLI Output Formats

AWS CLI offers different methods of displaying outputs for managing its services and resources using commands. The user can simply set the default output format to get all outputs in a particular format and the platform also enables the user to change the format by setting it with the query. All the formats offered by the platform to display AWS CLI outputs are as follows:

JSON Output Format

JSON is used to display data in textual form, and it is the most used AWS CLI output format as most programming languages can easily decode the JSON text. The user can get the output in JSON format containing the list of all the IAM users in the AWS account by executing the following code:

aws iam list-users --output json

The list of IAM users has been displayed in the JSON format:

YAML Output Format

YAML is another format that can be used to get the AWS CLI outputs. It is a good choice as most of the services like CloudFormation use its formatting. Now, get the list of IAM users in the YAML format by running the command mentioned below:

aws iam list-users --output yaml

The details of the IAM user have been displayed in the YAML format as displayed in the screenshot below:

YAML Stream Output Format

To take the YAML format to the next level, use the YAML Stream to get the huge data efficiently and provide a more interactive/faster response:

aws iam list-users --output yaml-stream

The IAM user’s list is displayed with its details like ARN, CreateDate, etc. in YAML Stream format displayed in the following snippet:

Text Output Format

The text output format simply displays the output in a single line and organizes the data in tab-delimited lines:

aws iam list-users --output text

Table Output Format

The name simply suggests that this format displays the output in tabular form with column names suggesting the data stored in its cells:

aws iam list-users --output table

The following screenshot displays the output in table format for the IAM users in the AWS account:

That is all about customizing the output formats of the AWS CLI commands.


To customize the output format of the AWS CLI response, simply configure AWS CLI to set the default output format. The user can also set the output format with each query using the “–output” with the name of the format offered by the platform to get the response in the said format. This post illustrated the process of customizing AWS CLI output formats.

Share Button

Source: linuxhint.com

Leave a Reply