S3 bucket listing that’s easier on the eyes

Update: I learned that Shrub exists. It’s much nicer than what I hacked up in an hour!

This is just a quick one.

I host a lot of public files on an Amazon S3 bucket. It’s my main mechanism for publishing releases of my open-source software.

So I was amazed to discover recently that S3 doesn’t have an easy way to just… show all the files. Like, not even a basic directory listing, which you could easily get with an Apache server. Just nothing.

Directory listing in Apache

This is all I wanted.

Well, that’s not entirely true. There is this ancient sample code from Amazon, made in 2008, that I found frozen in ice. But it looks like crap.

Amazon's standard S3 directory listing

“$folder$”? Seriously?

So I made a better one, using Bootstrap for styling. Below is a screenshot, and here it is in action.

My pretty Bootstrap S3 index.html

Much better.

To use it, just download the index.html file from the GitHub page and drop it into the root of your public S3 bucket. That’s it!

As an aside, isn’t it awesome how easy web development has become, thanks to modern tools like Bootstrap, JQuery, and Handlebars? That file from Amazon used 174 lines of Javascript, whereas mine is only 99. Of course I have three external dependencies, but I use CDNs, so you probably won’t notice a difference in performance. How cool is that?

10 responses to this post.

  1. Posted by Dan on November 24, 2014 at 2:52 PM

    you are the man!

    Reply

  2. This is excellent work, but getting errors with users who must use I.E.

    Reply

  3. Posted by Subhash on September 7, 2016 at 1:06 PM

    Works fine except I do not get the folder names. Any help will be appreciate.

    Reply

  4. Posted by yocup on September 25, 2016 at 11:13 PM

    fan-tas-tic. thanks, sir. (any ideas how to EXCLUDE folders or file types?

    Reply

  5. Posted by indica on December 20, 2016 at 8:26 AM

    Page limits do display only 1000 lines of output, is there a way to modify the page to list all the files.

    Reply

  6. Posted by Rakesh Ramachandran on May 26, 2017 at 2:51 PM

    If i place this index.html file and try to access s3 bucket url , its redirected to your github page. Anything i am doing wrong.

    Reply

  7. It only shows “Buket loading…”

    Reply

  8. Posted by Kuldeep Yadav on January 23, 2018 at 11:28 PM

    Works fine except I do not get the folder names. Any help will be appreciate.

    Reply

  9. I need one for a subdirectory of a bucket. I’m seeing nothing, just the headers :(.

    Reply

  10. […] the index.hml with modifications by Nolan Lawson (see also: Lawson's blog post and […]

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.