SimpleDB::Client - The network interface to the SimpleDB service.


version 1.0600


 use SimpleDB::Client;

 my $sdb = SimpleDB::Client->new(secret_key=>'abc', access_key=>'123');

 # create a domain
 my $hashref = $sdb->send_request('CreateDomain', {DomainName => 'my_things'});

 # insert attributes
 my $hashref = $sdb->send_request('PutAttributes', {
     DomainName             => 'my_things', 
     ItemName               => 'car',
     'Attribute.1.Name'     => 'color',
     'Attribute.1.Value'    => 'red',
     'Attribute.1.Replace'  => 'true',

 # get attributes
 my $hashref = $sdb->send_request('GetAttributes', {
     DomainName             => 'my_things', 
     ItemName               => 'car',

 # search attributes
 my $hashref = $sdb->send_request('Select', {
     SelectExpression       => q{select * from my_things where color = 'red'},


This class will let you quickly and easily inteface with AWS SimpleDB. It throws exceptions from SimpleDB::Client::Exception. It's very light weight. Although we haven't run any benchmarks on the other modules, it should outperform any of the other Perl modules that exist today.


The following methods are available from this class.

new ( params )


A hash containing the parameters to pass in to this method.


The access key given to you from Amazon when you sign up for the SimpleDB service at this URL:


The secret access key given to you from Amazon.


The constructor that SimpleDB::Client will connect to. Defaults to:


access_key ( )

Returns the access key passed to the constructor.

secret_key ( )

Returns the secret key passed to the constructor.

simpledb_uri ( )

Returns the URI object passed into the constructor that SimpleDB::Client will connect to. Defaults to:


user_agent ( )

Returns the LWP::UserAgent object that is used to connect to SimpleDB. It's cached here so it doesn't have to be created each time.

construct_request ( action, [ params ] )

Returns a string that contains the HTTP post data ready to make a request to SimpleDB. Normally this is only called by send_request(), but if you want to debug a SimpleDB interaction, then having access to this method is critical.


The action to perform on SimpleDB. See the "Operations" section of the guide located at


Any extra prameters required by the operation. The normal parameters of Action, AWSAccessKeyId, Version, Timestamp, SignatureMethod, SignatureVersion, and Signature are all automatically provided by this method.

send_request ( action, [ params ] )

Creates a request, and then sends it to SimpleDB. The response is returned as a hash reference of the raw XML document returned by SimpleDB. Automatically attempts 5 cascading retries on connection failure.

Throws SimpleDB::Client::Exception::Response and SimpleDB::Client::Exception::Connection.


See create_request() for details.


See create_request() for details.

handle_response ( response )

Returns a hashref containing the response from SimpleDB.

Throws SimpleDB::Client::Exception::Response.


The HTTP::Response object created by the send_request method.


This package requires the following modules:

XML::Fast LWP Time::HiRes Crypt::SSLeay Moose Digest::SHA URI Exception::Class



Bug Reports


There are other packages you can use to access SimpleDB. I chose not to use them because I wanted something a bit more lightweight that I could build SimpleDB::Class on top of so I could easily map objects to SimpleDB Domain Items. If you're looking for a low level SimpleDB accessor and for some reason this module doesn't cut the mustard, then you should check out these:

Amazon::SimpleDB (

A complete and nicely functional low level library made by Amazon itself.


A low level SimpleDB accessor that's in its infancy and may be abandoned, but appears to be pretty functional, and of the same scope as Amazon's own module.

In addition to clients, there is at least one other API compatible server out there that basically lets you host your own SimpleDB if you don't want to put it in Amazon's cloud. It's called M/DB. You can read more about it here: Though I haven't tested it, since it's API compatible, you should be able to use it with both this module and SimpleDB::Class.


JT Smith <jt_at_plainblack_com>

I have to give credit where credit is due: SimpleDB::Client is heavily inspired by the Amazon::SimpleDB class distributed by Amazon itself (not to be confused with Amazon::SimpleDB written by Timothy Appnel).


SimpleDB::Client is Copyright 2009-2010 Plain Black Corporation ( and is licensed under the same terms as Perl itself.