1

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

Volatil3
  • 275
  • 1
  • 3
  • 11

2 Answers2

2

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,

Also

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

https://docs.aws.amazon.com/cli/latest/userguide/pagination.html

strongjz
  • 832
  • 4
  • 7
0

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