Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

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

I am attempting to utilize the AWS CLI along with a for loop in bash to iteratively purge multiple SQS message queues. The bash script works almost as intended, the problem I am having is with the return value each time the AWS CLI sends a request. When the request is successful, it returns an empty value and opens up an interactive pager in the command line. I then have to manually type q to exit the interactive screen and allow the for loop to continue to the next iteration. This becomes very tedious and time consuming when attempting to purge a large number of queues.

Is there a way to configure AWS CLI to disable this interactive pager from popping up for every return value? Or a way to pipe the return values into a separate file instead of being displayed?

I have played around with configuring different return value types (text, yaml, JSON) but haven't had any luck. Also the --no-pagination parameter doesn't change the behavior.

Here's an example of the bash script I'm trying to run:

for x in 1 2 3; do 
  aws sqs purge-queue --queue-url https://sqs.<aws-region>.amazonaws.com/<id>/<env>-$x-<queueName>.fifo; 
done
over 4 years ago · Santiago Trujillo
6 answers
Answer question

0

You can set the environment variable PAGER to "cat" to force awscli to not start up less:

PAGER=cat aws sqs list-queues

I set up as a shell alias to make my life easier:

# ~/.zshrc
alias aws="PAGER=cat aws"
over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report

0

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

over 4 years ago · Santiago Trujillo Report

0

Inside your ~/.aws/config file, add:

cli_pager=

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!