# Connect a Gateway

With either AISIX Enterprise or AISIX Cloud, the AISIX gateway runs as the data plane in your infrastructure. Add a gateway to an environment so it can receive configuration and report heartbeats and telemetry. Live AI requests go directly to the gateway and do not pass through the selected product's control plane.

The gateway initiates outbound management connections authenticated with a certificate bundle issued for one AISIX Enterprise or AISIX Cloud environment.

## How the Connection Works[​](#how-the-connection-works "Direct link to How the Connection Works")

The certificate bundle contains a client certificate, private key, and CA certificate. The client certificate identifies the gateway and the environment it serves.

AISIX uses the same certificate identity for the configuration watch and the gateway management APIs. The configured management endpoint is also the base for heartbeat and telemetry requests. The gateway derives the configuration-store endpoint from that URL unless the deployment supplies a separate endpoint.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before connecting the gateway, prepare:

* An AISIX Enterprise or AISIX Cloud environment for the gateway.
* Outbound network access from the gateway host or cluster to the gateway management endpoint.
* A secret store for the client certificate and private key.
* Writable local storage for the gateway identity and materialized mTLS files. AISIX stores these under `/var/lib/aisix` by default.
* Permission in the AISIX Enterprise or AISIX Cloud Dashboard to issue gateway certificates and view registered data planes.

The state directory must be writable so the gateway can materialize its certificate bundle and identity. The generated container and Kubernetes instructions provide the bundle again at each start, so those files do not require persistent storage. To recover a successfully persisted configuration snapshot without first reconnecting to the control plane, enable the snapshot cache and mount its state directory on persistent storage. A persistent volume alone does not enable the cache. For this recovery, give each gateway instance its own volume and follow [Restart from Cached Configuration](https://docs.api7.ai/ai-gateway/cloud/offline-resilience.md#restart-from-cached-configuration).

## Issue a Gateway Certificate[​](#issue-a-gateway-certificate "Direct link to Issue a Gateway Certificate")

1. In the Dashboard for AISIX Enterprise or AISIX Cloud, select the environment the gateway should serve.
2. Open **Data planes**. If it already lists registered gateways, select **Add a data plane** to open the certificate form.
3. Select a **Validity** period and enter **Hostname (optional)** when the gateway needs a specific identity.

![Data plane certificate validity and optional hostname ready to be issued](https://static.api7.ai/uploads/2026/11/17/qBhNfy7k_gateway-issue-certificate.webp)

4. Select **Issue certificate**.
5. Open the tab for the target runtime and copy the generated install snippet.

caution

The private key appears only in the certificate-issuance response. Copy the bundle immediately, store it in your deployment secret system, and do not commit or share the generated snippet.

The AISIX Enterprise and AISIX Cloud Dashboards provide Docker, Docker Compose, Kubernetes (Helm), and systemd installation tabs. The systemd tab generates the service and credential configuration, but it does not install the executable or the managed startup configuration.

## Deploy on Kubernetes[​](#deploy-on-kubernetes "Direct link to Deploy on Kubernetes")

Use the **Kubernetes (Helm)** tab to install the `api7/aisix` chart. This is the only Kubernetes path the Dashboard generates. It includes a `preStop` pause and a termination grace period sized for connection draining, instead of leaving those settings at Kubernetes defaults.

For a chart-managed production deployment with autoscaling, disruption budgets, and Prometheus integration, follow the [Kubernetes deployment and operations guide](https://docs.api7.ai/ai-gateway/cloud/kubernetes.md).

## Start the Gateway[​](#start-the-gateway "Direct link to Start the Gateway")

For Docker or Docker Compose, run the generated command on the gateway host. For Kubernetes, use the Helm instructions described above.

### Prepare a systemd Host[​](#prepare-a-systemd-host "Direct link to Prepare a systemd Host")

The generated systemd unit does not install or update the gateway executable. Prepare the host before starting the service:

1. Obtain an `aisix-dp` executable for the target gateway version, operating system, and CPU architecture from API7 Support.
2. Install it at `/usr/local/bin/aisix-dp`, then record its version and checksum.
3. Copy [`config.managed.yaml`](https://github.com/api7/aisix/blob/v1.12.0/config.managed.yaml) to `/etc/aisix/config.managed.yaml`.
4. In the generated unit, remove the `AISIX_CONFIG_PATH` environment assignment.
5. Append `--config /etc/aisix/config.managed.yaml` to `ExecStart`.

`AISIX_CONFIG_PATH` belongs to the container entrypoint and is not a binary option.

Systemd upgrades

Container upgrade commands do not update a systemd-managed executable. Before an upgrade, confirm the replacement executable and rollback procedure with API7 Support. Keep the previous executable, unit, configuration, and persistent state, and validate the replacement on a test host.

### Check Ports and State Storage[​](#check-ports-and-state-storage "Direct link to Check Ports and State Storage")

The generated configuration uses these defaults:

* Port `3000` for proxy traffic.
* Port `9090` for metrics and status.
* `/var/lib/aisix` for the gateway identity, materialized mTLS files, and the snapshot cache when enabled.

Make `/var/lib/aisix` writable by the user that runs the gateway. Mounting only `/var/lib/aisix/mtls` leaves the gateway identity and optional snapshot cache outside the mount. See the [Port Reference](https://docs.api7.ai/ai-gateway/reference/ports.md) for listener exposure and outbound control-plane connectivity.

## Verify the Connection[​](#verify-the-connection "Direct link to Verify the Connection")

Verify the initial connection before configuring traffic:

1. Confirm that the process starts without certificate, trust-chain, or configuration-store connection errors.
2. Open **Data planes** and find the gateway under **Registered data planes**. Confirm that its status is **Healthy** and review **Last heartbeat**. Select **Refresh** if needed.
3. Confirm the hostname and check that the abbreviated **Certificate** value matches the start of the **Data plane ID** shown when you issued the bundle.

![Registered docs-gateway data plane showing Healthy and Compatible with a recent heartbeat](https://static.api7.ai/uploads/2026/11/17/cmoWL274_gateway-connected.webp)

After configuring a provider, model alias, and caller API key, verify the end-to-end data path. Confirm that projected resources reach the gateway, a live request succeeds, and its usage or telemetry appears in the control plane.

If the gateway does not appear, check the management endpoint, certificate bundle, trust root, file permissions, state directory, and outbound network access. A healthy heartbeat confirms the management API path, but it does not prove that a resource change has reached every gateway instance. Use [Resource Projection](https://docs.api7.ai/ai-gateway/cloud/resource-projection.md) after saving the first provider key, model, and caller API key.

## Customize the Managed Connection[​](#customize-the-managed-connection "Direct link to Customize the Managed Connection")

The generated instructions contain the settings required for a standard connection. Change them only when the deployment needs different credential injection, endpoints, or state storage:

* Use file-path variables when the certificate bundle is mounted as files. Use inline variables when the deployment system injects PEM content. Do not configure both forms for the same certificate, key, or CA bundle.
* Set `AISIX_MANAGED__CP_ETCD_ENDPOINT` only when the control plane provides a configuration-store endpoint that differs from the gateway management URL. Use `host:port` without a URL scheme.
* Set `AISIX_MANAGED__SNAPSHOT_CACHE_ENABLED=true` to enable the on-disk configuration snapshot cache. Setting only a cache path does not enable it.

See [Managed Connection Variables](https://docs.api7.ai/ai-gateway/reference/environment-variables.md#managed-connection-variables) for the complete variable catalog, formats, and defaults.

## Next Steps[​](#next-steps "Direct link to Next Steps")

Continue with [Choose a Provider Upstream](https://docs.api7.ai/ai-gateway/providers/overview.md). Each provider guide creates a provider key, model alias, and caller API key, then verifies the configuration with a live request through the connected gateway.

If a saved resource does not affect live traffic as expected, use [Resource Projection](https://docs.api7.ai/ai-gateway/cloud/resource-projection.md) to trace how environment configuration reaches the gateway.
