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?

6 responses to this post.

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

    you are the man!


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


  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.


  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?


  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.


  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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: