Tuesday, November 1, 2011

Renaming buckets on S3

A technical note, since the search engines of the internet don't seem to have noticed: Amazon's S3 management console lets you cut and paste files now (including whole folders).  So the process to "rename" an S3 bucket is simply:
  1. Create the new bucket with the desired name.
  2. Go to the old bucket and select all files: click the first and then shift+click the last.
  3. Above the file listing, in the button row, is one marked "Actions", which opens a menu that includes "Cut" and "Copy".  Pick one.
  4. Go to the new bucket, click Actions, and Paste your files.
Done.  No 3rd-party software required.

Why would anyone want to rename a bucket?  In our case, we created a StudlyCapsStyle bucket, which can't be used with CloudFront's dns-compatible-style.


In double-checking this post for accuracy, I noticed that Cut/Copy are available on the right-click menu for a single selection, but not the multi-select.  Weird.

2 comments:

Anonymous said...

Note that the console is written in Javascript, and so it works by your browser sending per-file requests to S3. So you will have to wait for your browser to send one http request per file you are copying. You will also incur a charge of one thousandth of a cent (at today's rates) for each of these requests.

So: this approach works, but if there are a million objects in the bucket, it will take between hours to days, and cost ten dollars.

sapphirepaw said...

AFAIK, that's an inherent limitation of S3's design. It's going to take a lot of requests no matter how you slice it, as long as the API doesn't have a native "rename bucket" operation.