How to turn off the pager for AWS CLI return value?

Just running into this issue myself, I was able to disable the behaviour by invoking the aws cli as AWS_PAGER="" aws ....

Alternatively you could simply export AWS_PAGER="" at the top of your (bash) script.

Source: https://github.com/aws/aws-cli/pull/4702#issue-344978525


You can disable pager either by exporting AWS_PAGER="" or by modifying you AWS cli config file.

export AWS_PAGER="" 

### or update your ~/.aws/config with 

[default]
cli_pager=

Alternatively, you can enable the default pager to output of less program as

export AWS_PAGER="less" 

or corresponding config change.

Ref: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside


You can also use --no-cli-pager in AWS CLI version 2.

See the "Client-side pager" section here https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html


I am using the aws cli v2 via docker and passing the --env AWS_PAGER="" on the docker run command fixed this issue for me on windows 10 using git bash.

I set it up as an alias as well so things work with jq.

How to set your docker env values:

  • https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file

Example alias: docker run --rm -it -v c:/users/me/.aws:/root/.aws --env AWS_PAGER="" amazon/aws-cli