Amazon SimpleDB

Amazon SimpleDB, which is a web service for running queries on structured data in real time. This service works in close conjunction with Amazon Simple Storage Service (Amazon S3) and Amazon Elastic Compute Cloud (Amazon EC2), collectively providing the ability to store, process and query data sets in the cloud.

Traditionally, this type of functionality has been accomplished with a clustered relational database that requires a sizable upfront investment, brings more complexity than is typically needed, and often requires a DBA to maintain and administer. In contrast, Amazon SimpleDB is easy to use and provides the core functionality of a database – real-time lookup and simple querying of structured data – without the operational complexity.

Yay! More AWS goodness.


The Data Model: Domains, Items, Attributes and Values
The data model used by Amazon SimpleDB makes it easy to input, manage and query your structured data. Developers organize their data-set into domains and can run queries across all of the data stored in a particular domain.  Domains are collections of items that are described by attribute-value pairs.

Think of these terms as analogous to concepts in a traditional spreadsheet table. For example, take the details of a product catalog shown in the table below and consider how they would be represented in Amazon SimpleDB.  The whole table/catalog would be your domain named “clothing.”  Individual products would be rows in the table or items in your domain.  The characteristics of items would be described by column headers (attributes).  Values are in individual cells.  Now consider the items below – a sweater, a dress shirt and a pair of shoes – are new products you would like to add to your domain.

In Amazon SimpleDB, to add the items above, you would PUT the three itemIDs into your domain along with the attribute-value pairs for each of the items.  Without the specific syntax, it would look something like this:

    PUT (item, 123), (description, sweater), (color, blue), (color, red)
    PUT (item, 456), (description, dress shirt), (color, white), (color, blue)
    PUT (item, 789), (description, shoes), (color, black), (material, leather)

API Summary
Amazon SimpleDB provides a small number of simple API calls which implement writing, indexing and querying data.  The interface and feature set are intentionally focused on core functionality, providing a basic API for developers to build upon and making the service easy to learn and simple to use.

  • CreateDomain – Create a domain that contains your dataset.
  • DeleteDomain – Delete a domain.
  • ListDomains – List all domains and associated metadata.
  • PutAttributes – Add or update an item and its attributes, or add attribute-value pairs to items that exist already. Items are automatically indexed as they are received.
  • GetAttributes – Retrieve an item and all or a subset of its attributes and values.
  • DeleteAttributes – Delete an item, an attribute, or an attribute value.
  • Query – Query the dataset using a query expression which specifies value tests on one or more attributes. Supported value tests are: =, !=, <, > <=, >=, starts-with. Example:  [“price” < “12.00”] AND [“color” = “green”]