AWSNinja Code Library

Name: awsninja_simpledbadmin

AWS Services: SimpleDB

Source: at GitHub

In a Sentence: A web interface for Amazon SimpleDB.

SimpleDBAdmin is an administration tool for Amazon SimpleDB.   If you don’t know what SimpleDB is here’s the first paragraph from Amazon’s SimpleDB site:

Amazon SimpleDB is a highly available, scalable, and flexible non-relational data store that offloads the work of database administration. Developers simply store and query data items via web services requests, and Amazon SimpleDB does the rest.

Why SimpleDBAdmin is Needed

I started building SimpleDBAdmin because I wanted a package to administer my SimpleDB data that met the following criteria:
  • Web-based - so it could be used by anybody anywhere
  • Free – for obvious reaons
  • Intuitive to use

There are a couple of web-based SimpleDB managers out there, but I found them to be incredibly difficult to use for actually manipulating data. They seem to be designed for the purpose of teaching basic SimpleDB concepts to programmers.  That’s a laudable goal but it’s not what I was looking for.  AWSZone and Amazon’s own JavaScript Scratchpad expose all of the intricacies of the SimpleDB API and require you to perform actions like “Invoke Request” or use “PutAttributes.”  Rather than deal with all that, I wanted a package that provides a higher level of abstraction and focuses mainly on letting the user view and manipulate data. SimpleDBAdmin is designed to meet that need.

How it was Built

Because I wanted to make it possible to use the application on any platform, the vast majority of the application is written in JavaScript and based on JQuery.  In addition to JQuery and JQuery UI, the following packages are also used:
Also included is a PHP component called relay.php that handles relaying the API commands to SimpleDB.  This is needed because the JavaScript Same Origin policy prevents a JavaScript application from sending requests to a separate domain name.  The relay.php component receives the completed request from the SimpleDBAdmin JavaScript package, passes it on to SimpleDB, receives the XML response from SimpleDB, converts it to JSON and passes it back to the JavaScript package.
Note: Your AWS Secret Key is not sent to the relay.php script.  Instead, the signed request is created in JavaScript and sent to relay.php.  This prevents your Secret Key from being exposed in the internet traffic between the browser and server.

SimpleDBAdmin Features

  • Supports saving multiple sets of AWS account credentials, useful if you manage SimpleDB data on multiple accounts.
  • Secret keys are encrypted and saved as cookies protected by a simple password.  You can access your SimpleDB account from the same computer without having to enter the AWS Access and Secret keys every time.
  • An elegant interface for storing, modifying and removing multiple values in the same attribute name.  Read about SimpleDB’s data model if you’re unfamiliar with SimpleDB’s ability to hold multiple values with the same attribute name.
  • Results are presented in a table format and are pageable.
  • Easily add and remove SimpleDB Domains.

Limitations and To-dos

  • No Sorting – Currently, Domain contents are returned in SimpleDB’s default order.  I believe that this is the same as the chronological order that the items were added, but not sure if this is aways true.
  • No Searching – The ability to search the items has not been added yet.
  • Large Data – Domains with a large number of attribute names or large attribute values will not display optimally in the web browser.
  • No Counts – The interface does not indicate the number of items in each Domain.

Installation

To install SimpleDBAdmin, download the package from GitHub and place the contents somewhere on your server’s web root.  Then navigate to the index.html with your web browser.  When you get it set up, it looks like this:
Login Dialog
Login Dialog

The Login Dialog

If it doesn’t work, you may need to adjust some of the paths within the index.html, relay.php or SimpleDbAdmin.js.

Usage

Once you’ve got the package installed and have the dialog shown above displayed in your browser, you then must enter your SimpleDB credentials.  To do this, fill in the form shown above with the following values:
  • Name – This is just the name that you want to give your account.  If you manage multiple SimpleDB accounts, this will help you keep track of them.
  • Access Key – This is your AWS Access Key Id, which can be found from the AWS Credentials page when you are logged into the website.
  • Secret Key – This is the AWS Secret Key associated with the Access Key and also found on the AWS Credentials Page.
  • Password – This is a password chosen by you.  When you return to SimpleDBAdmin from the same web browser, the accounts you created will be available to you if you can enter the password.  The password is used to encrypt your Secret Key, so that it is not stored in plaintext in your browser’s cookies.
Once you’ve entered your credentials, you should see your SimpleDB Domains (if any) listed on the left side of the screen.  You can click any of those Domains to browse through the data.  You can right click for the option to Delete a Domain (you will be asked to confirm this action).  You can also add a new Domain by clicking the “Add Domain” button.
Browse Data
Browse Data

Browse Data

You can edit an item row by clicking on it.  Doing so brings up the Edit Item dialog box:

Editing Data
Editing Data

Editing Data

Clicking the “Add Attribute Name” link will open a dialog that allows you to enter another name-value pair to the record.  When you are done making edits, click “Put” to save your changes.

Online Sample

You can give the application a try here:

http://samples.awsninja.com/awsninja_simpledbadmin/

Please don’t use the sample application to manage live web applications or to view or manipulate any sensitive data.  The application is not configured to examine or log your data -but you should install your own copy of SimpleDBAdmin to be completely secure.

If you’d like to install a copy on your own server, download it from GitHub.

I welcome questions, comments or suggestions.  Thanks for reading.