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.

Using S3-compatible buckets as private origins

Configure S3-compatible buckets to use as private origins for CDN delivery. Requests are authorized via signature version 4 to protect communication between your CDN service and the bucket. This is compatible with Fastly Object Storage, AWS S3, and most other S3-compatible storage offerings.