About this Library
- Based on the 2009-04-15 API version.
What's New?
- 2010-02-24: Support for consistent reads and conditional puts & gets.
- 2009-05-07: Deprecate Query and QueryWithAttributes. Please migrate to Select API
- 2009-03-23: Support for BatchPutAttributes
- 2008-12-26: Url and utf8 encoding fix for signature version 2
- 2008-12-17: Support for signature version 2, DomainMetadata and Select API, https endpoint
- 2008-08-28: Support for new API - QueryWithAttributes
Prerequisites
- Amazon SimpleDB account (http://aws.amazon.com/simpledb).
- Perl 5.6.0 or newer (http://www.perl.org/)
- Depending on the version of PERL you are using, you may need to install additional packages.
To install additional packages, run following command:
- perl -MCPAN -e 'install Digest::SHA'
- perl -MCPAN -e 'install XML::Simple'
- perl -MCPAN -e 'install Bundle::LWP'
- perl -MCPAN -e 'install Crypt::SSLeay'
Package Content
| Directory | Overview |
|---|---|
| src | Source distribution of library. |
Quick Start
Library comes with code samples for each available service API. To get started with the library, follow these steps:- Extract the amazon-simpledb-2009-04-15-perl-library.zip file into a working directory.
- Edit desired sample. For example: src/Amazon/SimpleDB/Samples/CreateDomainSample.pl
- Set AWS Access Key ID and AWS Secret Access Key
- Set request parameters. For example, find following pre-generated snippet:
- And set request with DomainName parameter:
- Run CreateDomain sample:
- You should see the output similar to the following:
- Experiment with samples. When ready, install library in the perl include path and use it.
my $AWS_ACCESS_KEY_ID = "<Your Access Key ID>";
my $AWS_SECRET_ACCESS_KEY = "<Your Secret Access Key>";
use Amazon::SimpleDB::Model::CreateDomainRequest;
# @TODO: set request. request can be passed as Amazon::SimpleDB::Model::CreateDomainRequest
# object or hash of parameters
# invokeCreateDomain($service, $request);
use Amazon::SimpleDB::Model::CreateDomainRequest;
my $request = Amazon::SimpleDB::Model::CreateDomainRequest->new;
invokeCreateDomain($service, $request->withDomainName("MyDomain"));
perl src/Amazon/SimpleDB/Samples/CreateDomainSample.pl
CreateDomainResponse
ResponseMetadata
RequestId
95cdcb68-f46c-400b-8265-8c2de2a5c475
Notes
You can use alternative hash-based interface with the library. For example, instead of:
my $request = Amazon::SimpleDB::Model::CreateDomainRequest->new;
$request->setDomainName("MyDomain");
my $response = $service->createDomain($request);
You can write:
my $response = $service->createDomain({DomainName => "MyDomain"});
Happy coding!
Making Requests to a Different Region
To make the service call to a different region, instantiate the client with the configuration object, and pass the region-specific endpoint. For example:
my $service = Amazon::SimpleDB::Client->new
($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY,
{"ServiceURL" => "https://sdb.eu-west-1.amazonaws.com"});
See the Amazon SimpleDB Developer Guide for a complete list of region endpoints.