# Akamai Edge KV

## How the Akamai Edge KV integration works

Statsig’s Akamai Edge KV integration pushes Statsig Configs to Edge KV, providing low latency for gate and experiment evaluations directly in Akamai Edge KV. With the correct prerequisites in place, setup takes approximately 60 minutes.

## Prerequisites

1. An Akamai account with [EdgeWorkers added to your contract](https://techdocs.akamai.com/edgeworkers/docs/add-edgeworkers-to-contract) and a Statsig account
2. [The Akamai CLI](https://developer.akamai.com/getting-started/cli)

## Set up Akamai EdgeWorker

1. Create an [EdgeWorker ID](https://techdocs.akamai.com/edgeworkers/docs/create-an-edgeworker-id-1)
2. Add the [EdgeWorker Behavior](https://techdocs.akamai.com/edgeworkers/docs/add-the-edgeworker-behavior-1)
3. Install the [Akamai CLI](https://developer.akamai.com/getting-started/cli)
4. Install the [Edgeworkers CLI](https://techdocs.akamai.com/edgeworkers/docs/akamai-cli#edgeworkers-cli)
5. Generate [EdgeGrid credentials](https://techdocs.akamai.com/developer/docs/edgegrid)

## Configure integration

First, enable the Akamai integration in the Statsig Console.

Navigate to *Project Settings > Integrations* at https://console.statsig.com/integrations and select **Akamai**.

### Authentication

Enter the EdgeGrid credentials you generated during Akamai EdgeWorker setup:

{% figure %}
![Authentication](https://docs.statsig.com/images/integrations/akamai/171a699c-2b78-435a-95c5-24b978738966.png)
{% /figure %}

### Configuration

Finalize the configuration by selecting a [namespace](https://techdocs.akamai.com/edgekv/docs/manage-access-to-edgekv) and [environment](https://techdocs.akamai.com/edgekv/docs/sandbox-support-edgekv).

You can also filter the configs synced into your KV namespace by a [Target App](https://docs.statsig.com/sdks/target-apps). Enable this option if your config payload grows. Leave this unchecked for now.

{% figure %}
![Configuration](https://docs.statsig.com/images/integrations/akamai/a2d63315-ab58-496d-901b-10aa6790979f.png)
{% /figure %}

After you complete these fields, click **Enable**.

Within a minute, the Statsig backend generates a config payload from your project and pushes it into your KV namespace. Navigate to **KV Pairs** under your KV namespace. You should see an entry with the prefix `statsig-`. The next segment is your project ID. Copy it; you need it later.

## Add Statsig SDK to worker

1. Create a Statsig [server secret key](https://docs.statsig.com/access-management/api-keys#server-secret-keys) and [configure it on Akamai](https://techdocs.akamai.com/developer/docs/edgegrid#credentials-as-environment-variables)
2. Clone the [Statsig Akamai Edge KV](https://github.com/statsig-io/akamai-statsig-example?tab=readme-ov-file#getting-started) repo (or if you already have an Edge KV package, apply these changes to it)
3. Follow instructions in the repo

## Related resources

[Akamai EdgeWorkers](https://developer.akamai.com/akamai-edgeworkers-overview)
[Statsig Akamai Edge KV Repo](https://github.com/statsig-io/akamai-statsig-example?tab=readme-ov-file#getting-started)
