Cobalt Edge

 
Filed under

Amazon

 

Delete an S3 Bucket Containing Thousands of Files

A backup bucket I had on Amazon S3 (via Jungle Disk) had gotten out of control and was costing me too much. I decided to kill it off completely and take a different approach. So, I wanted to delete the bucket. I thought, easy, I'll just use Interarchy, pick the bucket, hit delete and be done. Nope. Interarchy kept choking on some of the files. I tried a few times. Turned to Transmit, failed as well. So, instead, a few lines of Ruby, via the aws-s3 gem, and I was done, with one caveat.

Assuming you have the aws-s3 gem installed, I just used IRB to do it. First there was setting up the connection, and then finding the bucket in question:


require 'aws/s3'

AWS::S3::Base.establish_connection!(:access_key_id => 'put-yer-key-here', :secret_access_key => 'put-ye-ole-secret-key-here')

# Find the bucket the blunt way, by getting a list of the few I have, then picking the particular one (for me it was the second one in the array):

buckets = AWS::S3::Service.buckets
evil_bucket = buckets[1]

Then, you need to blow everything away. According to the docs, you should just be able to delete the bucket, passing the ":force => true" option, but that didn't work for me - it complained that the bucket didn't exist. So, instead I decided I'd delete everything in the bucket using the Bucket#delete_all call. That appeared to work, but it wasn't actually empty. Then I found that the library only pulls down 1000 files at a time (this is a standard S3 limitation in a listing call - although you'd think the library would realize this and loop until it was truly done), so it was only deleting 1000 files. So, the trick then was to do:


while !evil_bucket.empty?
puts "."
evil_bucket.delete_all
end
evil_bucket.delete

I have the puts in there, simply to observe progress (and it's also sort of fun to see how many files there really were). Obviously this is quick and dirty, but it wound up being far more effective, and nearly as simple as I had expected Interarchy to be. One note, if you do have a lot of files, this is not something that goes quick - it was taking about a minute per 1000 files (i.e. per delete_all call) on my system.

Loading mentions Retweet
Filed under  //   Amazon   Ruby  

Comments [0]

Amazon Kindle: First Use Thoughts

I received my Kindle the other day, and have had a chance to read with it for several hours now. So far, so great! I like it quite a bit. I'm going to keep this short, because the Kindle has been covered a lot elsewhere.

Things I like:


  • Trivial setup. The unit comes completely setup, tied to your account, and included all the books I'd already bought. All I had to do was turn the thing on and start using it. I did follow directions and plug it in to charge, which reached full within maybe 15 minutes. Also, the unit starts right into a quicky getting started, that I found to be just the right length and usefulness.

  • The "electronic ink" display is awesome. You can read this thing in any kind of light, no problems like you'd have with a laptop screen or many other devices. Very pleasant to read to as well, did not tire my eyes at all after several hours!

  • Easy to use UI. Basically, learn a couple buttons and the scroller and you're done.

  • Neato features like clippings, search, and bookmarks.

  • When the unit is in sleep mode, the display actually has an image on it, and it tells you how to wake it up (in case you forgot ;-)

What I don't like... I can really only think of two things to start off:


  • No PDF support. This is a pretty big deal. I knew this going in, but had read you could convert documents. You can, but have to use a Windows app, and it's unclear how well it works. I haven't tried it yet, but plan to. I was hoping to place some of the existing ebooks I have onto the Kindle this way. This is hands down my #1 complaint and the thing I truly hope Amazon can remedy. I understand the reasons, but I'd like to see them solve it, even if it's not ideal.

  • The price of subscribing to blogs. Usually it's cheap, such as $1/month, but really, blogs are free, and yes, obviously this is partially to cover Whispernet fees (which Amazon always says they cover in their docs, but obviously it's built into the price you're paying), and to cover management on your account, but seriously, it's a blog. How about you give us at least 10 for free, and then make them dirt cheap thereafter. Or at least don't tell us that you're covering the Whispernet fees.

All in all, I love this thing so far, and am really excited to see how I use it going forward. I very much like the idea that I can take this one thing when I travel, instead of having to either figure out what I might want to read ahead of time (I'm usually in the middle of a few books), or take multiple books with me. Also, nice to have even around the house, for just the ability to grab it and know I've got various reading material on it.

I will be most curious to see if I try blogs, newspapers, or magazines on it. Cost wise I probably won't, and I don't get a newspaper as it is (blogs, newspapers/news, I get all online). Magazines maybe, although most of the ones I read have a good visual component (various cycling mags, National Geographic Adventure and Outside, techy mags which typically don't translate to something like this very well, Wired, or whatever). Time will tell, but it's pretty cool so far.

Loading mentions Retweet
Filed under  //   Amazon   Books  

Comments [0]

Ordered an Amazon Kindle

I bit the bullet and ordered up an Amazon Kindle ebook reading device. I'm a big reader and this thing has serious appeal. As Don MacAskill says, I am often into several books at a time, and don't know what mood I'll be in, so when traveling it's hard to trim down the list to something easy to travel with.

I am also very intrigued by its ability to send documents to it, in particular PDF. The PDF translation (to the MOBI format the Kindle needs) is apparently not perfect, but this is huge, as it'll allow me to take all the ebook versions of tech books I have and use with me. I always have these on my laptop, but there are times when I want to actually sit down and read some of them (as opposed to just do a quick lookup while coding).

It's pretty promising, and I promise to review it once I have it, which won't be for a few weeks (mid-December is my approx ship date).

Loading mentions Retweet
Filed under  //   Amazon   Books  

Comments [0]

Amazon's UnSpun done with Ruby on Rails

Pretty cool... Amazon's latest service/site, UnSpun, was implemented with Ruby on Rails. I knew Amazon was looking at Rails, but this is great to see.

Loading mentions Retweet
Filed under  //   Amazon   RubyOnRails  

Comments [0]