The manakai project


Protocol features for Amazon Web Services (AWS) Web APIs


  use Web::Transport::AWS;
  $form = Web::Transport::AWS->aws4_post_policy
      (clock => Web::DateTime::Clock->realtime_clock,
       max_age => 60*60,
       access_key_id => $id,
       secret_access_key => $key,
       region => $region,
       service => 's3',
       policy_conditions => [
         {"bucket" => $bucket},
  ## Then, generate a form using $form:
  ##   <form metod=post
  ##       action="https://$service-$$bucket/">
  ##     <input type=hidden name=... value=...> created from $form
  ##     ...
  ##     <input type=hidden name="Content-Type" value="image/jpeg">
  ##     ...
  ##   </form>


The Web::Transport::AWS module implements protocol features for Amazon Web Services (AWS) Web APIs.


The following method is available:

$form = Web::Transport::AWS->aws4_post_policy (...)

Prepare form data including POST policy JSON and its signature.

It returns a hash reference of form data name/value pairs, which should be used as basis of construction of form data submitted to the AWS S3 end points.

The arguments are name/value pairs of following options:

clock => $clock (required)

The clock used to generate the current timestamps (e.g. Web::DateTime::Clock->realtime_clock).

max_age => $seconds (required)

The lifetime of the POST policy, in seconds from the generation.

access_key_id => $string (required)

The access key ID of the AWS credentials.

secret_access_key => $string (required)

The secret access key of the AWS credentials.

security_token => $string

The security token, as used in |X-Amz-Security-Token| header, if necessary.

region => $string (required)

The AWS region identifier.

service => $string (required)

The AWS service name, such as s3.

policy_conditions => [$condition, ...] (required)

An array refeference of the conditions in the POST policy.



Signature Calculations for the Authorization Header: Transferring Payload in a Single Chunk (AWS Signature Version 4) - Amazon Simple Storage Service <>.

Creating a POST Policy - Amazon Simple Storage Service <>.

Examples: Browser-Based Upload using HTTP POST (Using AWS Signature Version 4) - Amazon Simple Storage Service <>.


Wakaba <>.


Copyright 2017 Wakaba <>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Hey! The above document had some coding errors, which are explained below:

Around line 88:

You forgot a '=back' before '=head1'