AWS CLI Pagination Flashcards
By default, what is the page size used by AWS CLI? (i.e. how many items are returned per API call)
1.000
What happens if the number of returned items are over 1.000?
The CLI will make several calls but will still show everything in on go.
- E.g. 2.500 items would force the CLI to make 3 calls, but all 2.500 items would be shown at the same time
You are using the AWS CLI trying to list all items in an S3 bucket but you get a timeout error, what could be the reason?
The default page size of 1.000 is too high so it takes to long time to fetch all the items
How can you solve an AWS CLI Pagination Error?
- Specify the –page-size option to have the CLI request a smaller number of items from each API call.
- The CLI still received the full list, but performs a larger number of API calls in the background and receives a smaller number of items with each call.
You run
‘aws s3api list-objects –bucket mybucket ‘
What is the difference between ending the command with ‘–page-size 100’ vs ‘–max-items 100’?
- -page-size will tell the CLI to retrieve fewer items per call, but it will still fetch all the items in the bucket
- -max-items will tell the CLI to only fetch the 100 first items in the bucket
What can you do to solve a ‘timed out’ error or an error related to too many results being returned?
Adjust the pagination in the CLI results.