# How to Install Upstash Waiting Room

**Upstash Waiting Room** is an integration that helps you manage traffic surges and prevent overload on your websites and applications. The integration uses a *First-In, First-Out (FIFO)* approach and leverages on Azion **Firewall**, creating a waiting room to control and redirect access according to your parameters.

When a request is received by your website, **Firewall** executes the integration. Then, the integration verifies if there's available space and moves the request from the waiting queue to the release queue. If there isn't availability, the request is redirected to the waiting room, receiving a number in the row to access.

---

## Requirements

To start using this integration, you need to:

- Create an [Upstash account](https://console.upstash.com/).
- Create a Global Database for the best available edge latency in the [Upstash Console](https://console.upstash.com/).

---

## Getting the integration

To install this integration:

1. Access [Azion Console](/en/documentation/products/guides/how-to-access-azion-console/) > **Marketplace**.
2. On the Marketplace homepage, select the **Upstash Waiting Room** card.
3. On the integration page, click the **Install** button.

You'll see a message indicating that your integration was successfully installed.

:::tip
You can search any integration by browsing through the cards, using the filters, or typing a keyword in the search bar.
:::

---

## Configuring the integration

Once you've installed the **Upstash Waiting Room** integration, you'll need to complete the steps explained below to configure it.

### Setting up an firewall

Follow the steps:

1. On the upper-left corner, open the **Products menu** and select **Firewall** in the **Secure** section.
2. Click the **+ Firewall** button.
3. Give an easy-to-remember name to your firewall.
4. Turn the **Functions** switch on.
5. Click the **Save** button.

Done. Now you've instantiated the firewall for your function and have access to functions on your firewall.

:::caution[Warning]
If a product or module is activated, it could generate usage-related costs. Check the [pricing page](/en/documentation/products/pricing/) for more information.
:::

### Setting up the Firewall function

While still on the **Firewall** page:

1. Select the **Functions Instances** tab.
2. Click the **+ Function Instance** button.
3. Give an easy-to-remember name to your instance.
4. On the dropdown menu, select the **Upstash Waiting Room** function.
5. In the **Arguments** box, you'll pass your Upstash credentials and your variables:

```json
{
  "url": "https://region-database.upstash.io",
  "token": "YourUpstashToken",
  "ttl": 10,
  "ttl_wait": 180,
  "capacity": 2
}
```

Where:

| Variable | Mandatory | Description |
| ---- | ---- | ---- |
| `url` | Yes | URL string to connect on Upstash Redis. Go to your Upstash Console and copy the `UPSTASH_REDIS_REST_URL` in your database page |
| `token` | Yes | Token to access the Upstash Redis database. Go to your Upstash Console and copy the `UPSTASH_REDIS_REST_TOKEN` in your database page |
| `ttl` | Yes | Maximum time, in seconds, a user can stay on your website. Example: `180` |
| `ttl_wait` | Yes | Maximum time, in seconds, a user can remain inactive in the waiting room (for example, by closing the tab/window of the site) without losing their place. Example: `180` |
| `capacity` | Yes | Maximum number of simultaneous connections allowed on your website. Example: `10` |

6. Click the **Save** button.

### Setting up the Rules Engine

To finish, you must set up a rule in **Rules Engine** to configure the **criteria** and the **behavior** to run the function.

Still in the **Firewall** page:

1. Select the **Rules Engine** tab.
2. Click the **+ Rule Engine** button.
3. Give a name to the rule.
4. Select a *criteria* to run and catch the domains that you want to run the integration on.
  - Example: if `Host` *matches* `yourdomain.com`.
5. Below, select a *behavior* to the *criteria*. In this case, it'll be **Run Function**. 
    - Select the adequate function according to the name you gave it in the instantiate step.
6. Click the **Save** button.

On the Console, you must now configure your domain so your firewall protects it.

7. On the **Products menu**, select **Workloads**.
8. Click on the domain you want to protect with your Upstash Waiting Room function.
9. In the **Settings** section, click on the `Firewall` selector and choose the firewall you created.
10. Click the **Save** button.

Done. Now the **Upstash Waiting Room** integration is running.

:::tip
You can monitor the activity through the **Upstash Dashboard**.
:::

---