'Why doesn't running a aws s3api list-objects command return the NextToken?
I'm running the below command. Please note that the s3 bucket has a large number of files in it.
aws --profile=xxx s3api list-objects-v2 \
--bucket 'xxx' \
--max-items 2 \
--query 'Contents[].{Name: Key, LastModified: LastModified, Size: Size}'
According to the aws documentation, this should return a NextToken which I can use to get the next set of data. But the output simply contains 2 blocks with data on 2 objects in json format.
[
{
"Name": "xxx",
"LastModified": "xxx",
"Size": xxx
},
{
"Name": "xxx",
"LastModified": "xxx",
"Size": xxx
}
]
If I run the same command with --output text, it will print out the same data with a none at the end of it. not sure if it's related.
Solution 1:[1]
Thanks @riz. It was the query. Just had to change it to
--query '[{NextToken: NextToken},Contents[].{Name: Key, LastModified: LastModified, Size: Size}]'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sudh33ra |
