You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# client: low-level的接口(返回一个需要自己解析的dict)importboto3s3_client=boto3.client('s3')
# resource: high level面向对象接口importboto3s3_resource=boto3.resource('s3')
# 通过resource取到clients3_resource.meta.client# 类似百度网盘的分享功能,允许用户在一段时间内直接访问bucket中的某资源client.generate_presigned_url()
# 给bucket取个全球范围内不会重复的名字importuuiddefcreate_bucket_name(bucket_prefix):
# The generated bucket name must be between 3 and 63 chars longreturn''.join([bucket_prefix, str(uuid.uuid4())])
s3_resource.create_bucket(Bucket=YOUR_BUCKET_NAME,
CreateBucketConfiguration={
'LocationConstraint': 'eu-west-1'})
https://realpython.com/python-boto3-aws-s3/
两种创建client的接口
根据用户当前的session自动选择合适的location
不论是部署到 locally/EC2/Lambda
The text was updated successfully, but these errors were encountered: