digest.awsv4_hmac

STRINGdigest.awsv4_hmacSTRINGkeySTRINGdate_stampSTRINGregionSTRINGserviceSTRINGs

Available inall subroutines.

Returns an AWSv4 message authentication code based on the supplied key and input, signing the string s. The key is automatically prepended with the requisite "AWS", and should not be added by the caller.

This function does not support binary data for its secret_key or string to sign s parameters.

Example

declare local var.signature STRING;
set var.signature = digest.awsv4_hmac(
"wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY",
"20120215",
"us-east-1",
"iam",
"hello");

Try it out

digest.awsv4_hmac is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

AWS S3 bucket origin (private)

Use AWS authenticated requests (signature version 4) to protect communication between your Fastly service and AWS.