I always thought there was a 1,000 key limit when calling ListObjects in Amazon S3. However, I just made a call and it's pulling 1,080. But even their docs say there is a limit of 1,000.
I tried setting the MaxKeys setting to 1,000 but it still pulls 1,080 results. My code:
$iterator = $s3->getIterator('ListObjects', array(
'Bucket' => 'BUCKETNAME',
'MaxKeys' => 1000
));
It is however pulling folders as keys. But I certainly don't have 80 of them.
Two questions:
Thanks in advance!
The total volume of data and number of objects you can store are unlimited. Individual Amazon S3 objects can range in size from a minimum of 0 bytes to a maximum of 5 TB. The largest object that can be uploaded in a single PUT is 5 GB.
Amazon S3 automatically scales to high request rates. For example, your application can achieve at least 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests per second per partitioned prefix. There are no limits to the number of prefixes in a bucket.
You can use the NotPrincipal element of an IAM or S3 bucket policy to limit resource access to a specific set of users.
S3 can achieve at least 3,500 PUT/COPY/POST/DELETE and 5,500 GET/HEAD requests per second per prefix in a bucket.
The S3 API limit hasn't changed, it's still limited to a maximum of 1000 keys/response.
With the PHP SDK v1 a single request returned up to 1000 keys and to get the rest you needed to do a second request with the marker
option.
The new PHP SDK (v2) has a concept of Iterators which abstracts the process of doing these multiple, consecutive requests. This makes getting ALL of your objects much easier.
By default the API returns up to 1,000 key names. The response might contain fewer keys but will never contain more. A better implementation would be use the newer ListObjectsV2 API:
List<S3ObjectSummary> docList=new ArrayList<>();
ListObjectsV2Request req = new ListObjectsV2Request().withBucketName(bucketName).withPrefix(folderFullPath);
ListObjectsV2Result listing;
do{
listing=this.getAmazonS3Client().listObjectsV2(req);
docList.addAll(listing.getObjectSummaries());
String token = listing.getNextContinuationToken();
req.setContinuationToken(token);
LOG.info("Next Continuation Token for listing documents is :"+token);
}while (listing.isTruncated());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With