Saturday, August 9, 2008

SimpleDB in EC2 Ubuntu

I am showing here the How to guide for amazon-simpledb-cli(Command Line Interface)
This tool depends on the following Perl modules from CPAN:

You can install them using the "cpan" command on many Linux distros:
sudo cpan Getopt::Long
sudo cpan Pod::Usage
sudo cpan Digest::SHA1
sudo cpan Digest::HMAC
sudo cpan XML::Simple

This tool also depends on the Amazon::SDB modules provided by Amazon(not the one in CPAN). Amazon's modules can be found here:

Here is the How to for the above:
curl -Lo \


sitelib=$(perl -MConfig -le 'print $Config{sitelib}')
sudo scp -r amazon-simpledb-*-perl-library/src/Amazon $sitelib

Finally, this command line interface can be installed with:

sudo curl -Lo /usr/local/bin/simpledb
sudo chmod +x /usr/local/bin/simpledb

Now to test your installation::
  1. Extract the file into a working directory.
  2. Edit desired sample. For example: src/Amazon/SimpleDB/Samples/

    • Set AWS Access Key ID and AWS Secret Access Key
    •  my $AWS_ACCESS_KEY_ID        = "";
      my $AWS_SECRET_ACCESS_KEY = "";

    • Set request parameters. For example, find following pre-generated snippet:
    •  use Amazon::SimpleDB::Model::CreateDomain; 
      # @TODO: set action. Action can be passed as Amazon::SimpleDB::Model::CreateDomain
      # object or hash of parameters
      # invokeCreateDomain($service, $action);

    • And set action with DomainName parameter:
    •  use Amazon::SimpleDB::Model::CreateDomain; 
      my $action = Amazon::SimpleDB::Model::CreateDomain->new;
      invokeCreateDomain($service, $action->withDomainName("MyDomain"));

  3. Run CreateDomain sample:
  4.    perl src/Amazon/SimpleDB/Samples/
  5. You should see the output similar to the following:

  6.     CreateDomainResponse

  7. Experiment with samples. When ready, install library in the perl include path and use it.

Amazon SimpleDB (SDB)

Amazon SimpleDB Developer Guide

AddThis Feed Button

1 comment:

satpla said...

Saltmarch Media is organizing Great Indian Developer Summit event in Bangalore. This Summit will be a boost for the Software Developing Industries. It covers the topics like .Net, Java, SimpleDB, MongoDB, NoSQL and Richweb and has 1 day workshop at the end as well. Any one attending this event?

Register @