The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Amazon::AWSSign - Perl extension to create signatures for AWS requests

SYNOPSIS

  use Net::Amazon::AWSSign;
  my $awsKey="AWS_Access_Key";  # Get this from AWS if you don't already have one
  my $awsSecret="AWS_Secret_Key";  # Get this from AWS if you don't already have one
  my $awsSign=new Net::Amazon::AWSSign("$awsKey", "$awsSecret");  # New object
  # SOAP
  my $awsSOAPAction=ItemSearch;
  my ($SOAPTimestamp, $SOAPSignature)=$awsSign->SOAPSig($awsSOAPAction);
  # REST
  my $awsASIN='B000002U82';   # Dark Side of the Moon
  my $awsRESTURI="http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Operation=ItemLookup&ItemId=$awsASIN&ResponseGroup=Medium"; # Simple lookup
  my $awsSignedRESTURI=$awsSign->addRESTSecret($awsRESTURI);  # Returns signed REST query URI for lwp-get, curl, etc.

DESCRIPTION

This module can be used to sign requests to Amazon's AWS. While this is designed for AWS, it should work for pretty much any service, since the signing method is the same for all Amazon services.

The synopsis pretty much says it all. But, in the interest of full documentation, here are the available methods.

METHODS

  • $object->SOAPSig(AWS_Action);

    Returns values for aws:Timestamp and aws:Signature to be included in your SOAP header. AWS recommends that you use certificate-based WS-Security instead of this method, but if you just need to do some quick and dirty one-time work it'll get the job done.

  • $object->addRESTSecret(Unsigned_URI);

    Takes an unsigned REST URI as an argument and returns the signed URI. If the key is not already found in the string it will be automatically added before signing.

SEE ALSO

Net::Amazon::Signature - if AWSSign doesn't meet your needs, then maybe this will.

AUTHOR

Naton Aiman-Smith, <naton@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Naton Aiman-Smith

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.