Rename Key in S3 (Python)
S3 has no rename functionality.
You need to copy to a new 'file' and delete the original.
In python using boto3
You need to copy to a new 'file' and delete the original.
In python using boto3
s3 = boto3.resource('s3')
s3.Object('my_bucket','my_file_new').copy_from(CopySource='my_bucket/my_file_old')
s3.Object('my_bucket','my_file_old').delete()
Comments
Post a Comment