I have a file contained in a key in my S3 bucket. I want to create a new key, which will contain the same file. Is it possible to do without downloading that file? I'm looking for a solution in Python (and preferably boto library).
I have a file contained in a key in my S3 bucket. I want to create a new key, which will contain the same file. Is it possible to do without downloading that file? I'm looking for a solution in Python (and preferably boto library).
Where bucket is the destination bucket:
bucket.copy_key(new_key,source_bucket,source_key)
Although nobody asked, I thought it might be relevant to show how to do this with simples3:
>>> b.copy("my_bucket/file.txt", "file_copy.txt", acl="public")
I'm not sure what Boto does here, but it's worth noting that the permissions (ACL) will not be copied by S3, it will be reset to "private" if nothing else is specified. To copy the ACL, you have to ask for it first.