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

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

Popular posts from this blog

Recursively Delete files of the Same Name in S3

Python - datetime Formatting

ORACLE RDS granting select privileges to users.