---
title: digest.awsv4_hmac
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/cryptographic/digest-awsv4-hmac
---

```
STRING digest.awsv4_hmac(STRING key, STRING date_stamp, STRING region, STRING service, STRING s)
```

**Available in:** all 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

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