I am trying to list content by using aws s3api for listing bucket content. I

aws s3api list-objects --bucket user_list_staging

When I run it it gets stuck, does not return anything neither return prompt but when I do aws s3 ls s3://user_list_staging it returns the content.

The reason I want to use s3api to paginate my query and get Next Token which I don't find in aws s3 ls


A Couple things that can help.

--debug (boolean)

Turn on debug logging.

will add some debug output to let you know what is going on,


If you see issues when running list commands on a large number of resources, the default page size may be too high, causing calls to AWS services to time out.

aws s3api list-objects --bucket my-bucket --page-size 100



Limiting the page size does not actually affect the number of items returned in the output; therefore it will not actually help if the result size is too large. You'll need to use --max-items which does limit the number of items returned.

aws s3api list-objects --bucket my-bucket --max-items 100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.