How to Rename an S3 bucket

AWS does not support renaming an S3 bucket. If you’ve created a bucket with the incorrect name and would like to rename it, you’d have to first create a new bucket with the appropriate name and copy contents from the old bucket to the new one.

STEP 1: Create new bucket as below where new-bucket-name is the name of the bucket:

aws s3 mb s3://new-bucket-name

STEP 2: Copy all the contents from old bucket to new bucket as below:

aws s3 sync s3://old-bucket-name s3://new-bucket-name

You can also move contents(instead of copying) from old bucket to new bucket as below:

aws s3 mv s3://old-bucket-name s3://new-bucket-name --recursive

STEP 3: Remove old bucket as below:

aws s3 rb --force s3://old-bucket-name

See also  How to install and configure AWS CLI on Windows and Linux machines