以下是一个示例程序,它每小时上传100个对象,以演示如何使用AWS SDK将S3使用限制降低到一定程度:
import boto3 from random import randint import time
s3 = boto3.resource('s3') bucket = s3.Bucket('my-bucket-name')
while True: for i in range(100): bucket.put_object(Body='Sample object content', Key='object_number_{}'.format(randint(0, 1000)))
print('Uploaded 100 objects to S3 at', time.strftime('%H:%M:%S'))
time.sleep(3600)
以下是几个示例工具: