Perl Library for Amazon SimpleDB

Sample Code & Libraries>Perl Library for Amazon SimpleDB
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

Perl Library for Amazon SimpleDB

Details

Submitted By: Elena@AWS
AWS Products Used: Amazon SimpleDB
Language(s): Perl
License: Apache License 2.0
Created On: December 27, 2007 9:32 PM GMT
Last Updated: February 24, 2010 11:32 PM GMT
Download

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:
  1. Extract the amazon-simpledb-2009-04-15-perl-library.zip file into a working directory.
  2. Edit desired sample. For example: src/Amazon/SimpleDB/Samples/CreateDomainSample.pl


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


    • Set request parameters. For example, find following pre-generated snippet:
    •  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);
                      


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

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


  6.     CreateDomainResponse
            ResponseMetadata
                RequestId
                    95cdcb68-f46c-400b-8265-8c2de2a5c475
                

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

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.

Previous Version Download

Comments, Questions or Feedback

If you have any comments, questions or feedback on the library, please start discussion here.
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.