aws_sign_string

The aws_sign_String statement is used to generate an AWS4-HMAC-SHA256 signature, used as the signature component of the Authorization HTTP header when calling the AWS API.

Syntax

aws_sign_stringvarNameusingsecret_key date region service

Details

The authentication method used by AWS requires the generation of an authorization signature which is derived from a secret key known to the client along with specific elements of the query being made to the API.

This is a fairly involved process and a full step-by-step walkthrough is provided by Amazon on the following pages (these should be read in the order listed below):

The aws_sign_string statement is used to generate the final signature as detailed on the calculate signature page listed above.

Note that in order to use this statement it is necessary to have the following strings available:

  1. A string to sign, obtained by following the process of creating a string to sign, containing meta-data about the request being made

  2. A secret_key, obtained from Amazon which is used by any client application authorizing against their API

  3. The date associated with the API request, in YYYYMMDD format

  4. The AWS region associated with the API request (for example eu-central-1)

  5. The AWS service being accessed (for example s3)

The aws_sign_string statement will use these inputs to generate the HMAC-SHA256 signature which is a component of the Authorization header when connecting to the API itself.

The varName parameter is the name of a variable containing the string to sign. After executing aws_sign_string the contents of this same variable will have been updated to the base-16 encoded signature value.

Example

The following is an example USE script that implements everything described above.

Last updated

Was this helpful?