import boto3
boto3_session
= boto3
.Session
(aws_access_key_id
=xxx
,
aws_secret_access_key
=xxx
,
region_name
='cn-north-1')
s3
= boto3_session
.resource
('s3')
boto3_client
= boto3_session
.client
('s3')
for bucket
in s3
.buckets
.all():
print('bucket name:%s' % bucket
.name
)
bucket
= s3
.Bucket
('xx')
for obj
in bucket
.objects
.all():
print('bucket obj key:%s' % obj
.key
)
copy_source
= {
'Bucket': 'xx',
'Key': 'old/1000.gz'
}
s3
.meta
.client
.copy
(copy_source
, 'xx', 'new/1000.gz')
转载请注明原文地址: https://win8.8miu.com/read-4691.html