---
title: bereq.awsv4_sign_with_keys
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/cryptographic/bereq-awsv4-sign-with-keys
---

```
VOID bereq.awsv4_sign_with_keys(STRING access_key, STRING secret_key, STRING region, STRING service)
```

**Available in:** miss, pass

Generates headers required for AWS Sigv4 signing based on the current state of
`bereq`. The arguments are used directly in the Sigv4 signing algorithm, and
must match the values required to produce a valid signature.

Note that bereq.url.path must be in normalized form when calling this, as no
implicit normalization is applied either to the request path, or the
representation signed.

The headers `x-amz-content-sha256`, `x-amz-date`, and `authorization` will be
overwritten with the resulting computed values.

## Errors

If this function fails to complete signing the request, `fastly.error` will be
set to `EAWSSIGN`.

## Example

```vcl
bereq.awsv4_sign_with_keys(
  "AKIAIOSFODNN7EXAMPLE",
  "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
  "us-east-1",
  "s3"
);
```
