> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nomad.media/llms.txt
> Use this file to discover all available pages before exploring further.

# Nomad Media Authorizer Setup

How to add the Nomad Media Authorizer Lambda to your own AWS API Gateway.

# Nomad Media Authorizer Setup

API Gateways in your AWS account can use the existing Nomad Media Authorizer Lambda to secure custom routes. This guide covers setup for both HTTP API Gateway and REST API Gateway.

For a sample Lambda that reads the authorizer attributes, see [Event-Driven Workflows](./event-driven-workflows.md#custom-lambda-with-nomad-media-authorizer).

## HTTP API Gateway Setup

### Step 1: Create the Authorizer

1. Select your HTTP API Gateway and go to **Authorization** in the left menu
2. Select the **Manage authorizers** tab and click **Create**
3. Select **Lambda** as the authorizer type
4. Give it a name such as `Nomad-Authorizer` (allowed characters: letters, numbers, `.`, `_`, `-`)
5. Select the correct region and choose the Lambda function — it is named something like `nomad-{name}-gw-resources-StrictFunction-{uniqueID}`
6. Under **Response mode**, select **IAM Policy**
7. Leave caching settings at defaults (or adjust as needed)
8. Under **Invoke permissions**, toggle **Automatically grant API Gateway permission to invoke your Lambda Function**
9. Click **Create**

### Step 2: Configure Parameter Mapping for an Endpoint

1. Select your HTTP API Gateway → **Integrations** in the left menu
2. In the **Routes** section, select the endpoint to configure
3. Click **Manage integration**
4. Under **Parameter mapping**, click **Create**
5. Set **Mapping type** to **All incoming request**
6. Add the following mappings:

| Parameter to modify   | Modification type | Value                |
| --------------------- | ----------------- | -------------------- |
| `header.nomad-email`  | Overwrite         | `.authorizer.email`  |
| `header.nomad-name`   | Overwrite         | `.authorizer.name`   |
| `header.nomad-userId` | Overwrite         | `.authorizer.userId` |

7. Click **Create**

### Step 3: Attach the Authorizer to the Endpoint

1. In the **Route details** view, click **Attach authorization**
2. Under **Select existing authorizer**, choose the authorizer you created
3. Click **Attach authorizer**

The endpoint is now secured using the Nomad Media Authorizer Lambda.

***

## REST API Gateway Setup

### Step 1: Create the Authorizer

1. Select your REST API Gateway → **Authorizers** in the left menu
2. Click **Create New Authorizer**
3. Give it a name such as `Nomad-Authorizer`
4. Select **Lambda** as the type
5. Select the correct region and choose the Lambda function (`nomad-{name}-gw-resources-StrictFunction-{uniqueID}`)
6. Leave **Lambda Invoke Role** empty
7. Under **Lambda Event Payload**, select **Token**
8. Uncheck **Authorization Caching**
9. Click **Create**
10. When the popup appears ("API Gateway needs your permission to invoke your Lambda function"), click **Grant & Create**

### Step 2: Attach the Authorizer to an Endpoint

1. Select your REST API Gateway → **Resources** in the left menu
2. Select the route to configure
3. Click **Method Request**
4. Under **Settings**, click the edit button next to **Authorization**, select your authorizer, and click the checkmark to save
5. Go back to **Method execution** by clicking the link
6. Click **Integration Request**
7. Ensure **Use Lambda Proxy Integration** is checked
8. Deploy the REST API Gateway to your stage to apply changes