I have run a lot of benchmarks using S3 with more than 10 thousands objects with no issues, so I’m not quite sure what is the problem here.
I just ran this small test and it worked with LocalStack 3.0.0.
import boto3
from mypy_boto3_s3 import S3Client
s3: S3Client = boto3.client("s3", endpoint_url=f"http://localhost:4566")
s3.create_bucket(Bucket="test")
for i in range(3000):
# padding the object for lex. ordering
s3.put_object(Bucket="test", Key=f"object_{i:04}", Body="test")
list_1 = s3.list_objects_v2(Bucket="test")
continuation_token = list_1["NextContinuationToken"]
print("Print first object list 1", list_1["Contents"][0])
print("Print first object list 1", list_1["Contents"][-1])
list_2 = s3.list_objects_v2(Bucket="test", ContinuationToken=continuation_token)
continuation_token = list_2["NextContinuationToken"]
print("Print first object list 2", list_2["Contents"][0])
print("Print first object list 2", list_2["Contents"][-1])
list_3 = s3.list_objects_v2(Bucket="test", ContinuationToken=continuation_token)
print("Print first object list 3", list_3["Contents"][0])
print("Print first object list 3", list_3["Contents"][-1])
# using built-in paginator
paginator = s3.get_paginator("list_objects_v2")
result = paginator.paginate(Bucket="test").build_full_result()
print("printing amount of objects in bucket", len(result["Contents"]))
This is printing:
Print first object list 1 {'Key': 'object_0000', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 51, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
Print first object list 1 {'Key': 'object_0999', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 53, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
Print first object list 2 {'Key': 'object_1000', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 53, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
Print first object list 2 {'Key': 'object_1999', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 55, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
Print first object list 3 {'Key': 'object_2000', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 55, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
Print first object list 3 {'Key': 'object_2999', 'LastModified': datetime.datetime(2023, 11, 18, 22, 17, 57, tzinfo=tzutc()), 'ETag': '"098f6bcd4621d373cade4e832627b4f6"', 'Size': 4, 'StorageClass': 'STANDARD'}
printing amount of objects in bucket 3000
Could you share exactly how you are using pagination?