How to turn off the Pager in AWS CLI

avatar

Borislav Hadzhiev

Last updated: Sep 30, 2021

banner

Photo from Unsplash

How to turn off the Pager in AWS CLI #

To turn of the pager for an AWS CLI command, set the --no-cli-pager parameter, e.g. aws ec2 describe-instances --no-cli-pager. The --no-pager parameter disables the pager for a single command.

shell
aws ec2 describe-instances --no-cli-pager

The easiest way to disable the pager for all AWS CLI commands is to update your credentials file and set the cli_pager = setting below a profile's credentials.

On linux and macOS, the credentials file is located at ~/.aws/credentials.

On windows the credentials file is located at C:\Users\USERNAME\.aws\credentials.

This shows how to disable the pager for a profile named tester, in the credentials file:

credentials
[tester] aws_access_key_id = YOUR_ACCESS_KEY_ID aws_secret_access_key = YOUR_SECRET_KEY cli_pager =
The cli_pager setting applies to a specific profile, so you would probably have to add it below the credentials of multiple profiles.

An alternative is to set the AWS_PAGER environment variable on your machine. This applies to all profiles.

shell
# on Linux and macOS export AWS_PAGER="" # on Windows setx AWS_PAGER ""
To make the environment variable persist on Linux and MacOS, add theexport AWS_PAGER="" line to your shell's startup script, e.g. ~/.bashrc.

If the AWS_PAGER environment variable is set to an empty string, it is applied to all AWS CLI profiles on the machine.

Further Reading #

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.