ENTRIES
Welcome to Eric Cheng's online journal! You are not logged in. [ Log in ]
« Introducing ECHENG TV :: index :: Upgraded to Wordpress 2.6 »

How to delete an Amazon S3 bucket with lots of files in it

:: Monday, July 14th, 2008 @ 6:28:51 pm

:: Tags:

This may be common knowledge for those of you who live in S3 land, but it took me awhile to figure out.

If you’re on Mac OS X or have access to a system with Ruby on Rails installed, it’s easy to delete a bucket and all of its keys.

  1. download s3sync and s3cmd
  2. configure s3sync’s environment (like it says to do in the README)
  3. open a terminal window and run “s3cmd.rb deleteall bucketname”
  4. then, if you want to delete the bucket itself, run “s3cmd.rb deletebucket bucketname”

On my MacBook Pro on an EVDO connection, it seems to be deleting 4 keys per second, or just over 4 minutes for 1,000 keys and 7 hours for 100,000 keys. ECHENG.COM alone has around 68,000 files in it. 45 days of backups = about 3 million files. My calculations tell me that it will take 35 days of constant deleting to remove all of the keys, and that’s only for ECHENG.COM. Wetpixel is pretty big, too.

I’m screwed. :(

UPDATE On my Mac Pro on DSL, it’s deleting 10-15 keys per second. That is much better.


success! it’s slow, but it looks like it’s working

THE HISTORY, IF YOU CARE

I asked my server guys to use S3 as a backup repository for wetpixel.com and echeng.com, and they filled it up with a month and a half of FULL daily backups instead of doing something incremental. My sites are relatively large, and this resulted in 260GB of data spanning hundreds of thousands of files (”keys” in S3). I have been paying $40-60/month for S3 usage, and I wasn’t too happy after I discovered that the most recent backup was 6 months old (luckily, I’m told that they have been backing me up to their own drives instead).

I tried to delete the useless buckets, but discovered that you must delete all of the keys in a bucket before you can delete it, and keys have to be deleted one at a time. There have been requests in the S3 forums for a feature that allows bucket deletion without prior removal of files, but the S3 folks replied saying that it was a “low priority.”

I’m on the Mac, and normally use S3 Browser.app and Transmit.app to access my S3 buckets. I tried deleting a bucket using Transmit, but it failed repeatedly with an error after it deleted some number of keys (it consistently fails, but can take 15 or 20 minutes before the error). S3 Browser is an app that fails to inspire confidence — it loads some number of keys at a time in bursts (1000, I think) and appends them to a single, scrolling list. I didn’t want to find out what might happen if I let it pull down the entire list of files.

I started looking for other options, and eventually found s3sync and s3cmd. I then discovered that Ruby on Rails comes installed by default on Leopard, which was convenient. And now, I’m watching a scrolling list of files as they are removed from my bucket, which is very satisfying.

| Popularity: 1% | Manzanita, OR | link | trackback | Jul 14, 2008 18:28:51

:: 1 comment (rss)

  1. posted by AltJ on Mon, September 22, 2008 @ 11:25 am

    You should fire up an EC2 instance and see how fast it is able to delete items. It wouldn’t surprise me if it goes 10x faster than doing it over your DSL connection.

:: leave a reply

Use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

RECENT MICROBLOG ACTIVITY

Posting tweet...

ARCHIVES
Journal Home
Where is Eric? (password)
Stuff for Sale
October 2008 (12)
September 2008 (25)
August 2008 (34)
July 2008 (34)
June 2008 (32)
May 2008 (26)
April 2008 (15)
March 2008 (19)
February 2008 (31)
January 2008 (43)
December 2007 (33)
November 2007 (29)
October 2007 (29)
September 2007 (9)
August 2007 (19)
July 2007 (10)
June 2007 (17)
May 2007 (26)
April 2007 (38)
March 2007 (39)
February 2007 (13)
January 2007 (35)
December 2006 (35)
November 2006 (14)
October 2006 (6)
September 2006 (20)
August 2006 (24)
July 2006 (32)
June 2006 (17)
May 2006 (23)
April 2006 (16)
March 2006 (16)
February 2006 (26)
January 2006 (34)
December 2005 (17)
November 2005 (21)
October 2005 (18)
September 2005 (17)
August 2005 (5)
July 2005 (15)
June 2005 (20)
May 2005 (25)
April 2005 (7)
March 2005 (22)
February 2005 (20)
January 2005 (38)
December 2004 (6)
November 2004 (24)
October 2004 (16)
September 2004 (22)
August 2004 (12)
July 2004 (17)
June 2004 (15)
May 2004 (11)
April 2004 (35)
March 2004 (40)
February 2004 (29)
January 2004 (36)
December 2003 (20)
November 2003 (18)
October 2003 (10)
September 2003 (18)
August 2003 (10)
July 2003 (34)
June 2003 (12)
May 2003 (49)
April 2003 (42)
March 2003 (42)
February 2003 (15)
January 2003 (7)
December 2002 (17)
November 2002 (19)
October 2002 (24)
September 2002 (22)
August 2002 (20)
July 2002 (21)
June 2002 (14)
May 2002 (15)
April 2002 (11)
March 2002 (13)
February 2002 (20)
January 2002 (17)
December 2001 (16)
Even Older Journal
Travel Journals

VIENNA TENG
Support my friend and favorite singer-songwriter, Vienna Teng!

--- Next Show ---

Schedule coming soon.
[ discography ]

Eric Cheng's RSS Journal Journal RSS
Eric Cheng's RSS Journal Comments RSS

Rice Bowl Journals

proudly powered by wordpress
script exec time: 0.59s
i hate computers.