Skip to content

Instantly share code, notes, and snippets.

@holypriest
Created December 10, 2020 02:13
Show Gist options
  • Save holypriest/1b43de8efd9f87a613e2e22200e8ea82 to your computer and use it in GitHub Desktop.
Save holypriest/1b43de8efd9f87a613e2e22200e8ea82 to your computer and use it in GitHub Desktop.
Don't even start...
import boto3
sess = boto3.session.Session(region_name='us-east-1')
s3res = sess.resource('s3')
gazillion_files = [('my-source-bucket', 'file-000000000001'), ...]
for f in gazillion_files:
copy_source = {
'Bucket': f[0],
'Key': f[1]
}
s3res.meta.client.copy(
CopySource=copy_source,
Bucket='my-destination-bucket',
Key=f[1],
ExtraArgs={'StorageClass': 'GLACIER'}
)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment