How to turn off the Pager in AWS CLI

avatar

Borislav Hadzhiev

Thu Sep 30 20212 min read

banner

Photo by Grant Ritchie

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 #

Join my newsletter

I'll send you 1 email a week with links to all of the articles I've written that week

Buy Me A Coffee