# Multi-Region Deployment Patterns

Deploying API7 Gateway across multiple geographic regions enables you to serve users globally with low latency and provides a robust disaster recovery solution. This page explores common multi-region deployment patterns and their configuration considerations.

## Multi-Region Deployment Patterns[​](#multi-region-deployment-patterns "Direct link to Multi-Region Deployment Patterns")

Choose a deployment pattern based on your availability, latency, and operational requirements.

### Active-Active Deployment[​](#active-active-deployment "Direct link to Active-Active Deployment")

In an active-active pattern, API7 Gateway is deployed and actively serves traffic in two or more regions simultaneously.

* **Global Load Balancing (GSLB)**: Use a GSLB service (e.g., AWS Route 53, Cloudflare) to route users to the nearest healthy region based on latency or geographic proximity.
* **Independent Control Planes**: Each region typically has its own Control Plane and Data Plane cluster to minimize cross-region dependency.
* **Data Replication**: Synchronize configurations across Control Planes using ADC (API Declarative CLI) or CI/CD pipelines.

### Active-Passive Deployment (Disaster Recovery)[​](#active-passive-deployment-disaster-recovery "Direct link to Active-Passive Deployment (Disaster Recovery)")

In an active-passive pattern, one region is designated as the primary region, while the other serves as a standby.

* **Failover**: If the primary region fails, the GSLB service redirects all traffic to the passive standby region.
* **Standby Capacity**: The standby region can be maintained at a smaller scale and scaled up during a failover event.
* **PostgreSQL Replication**: Use PostgreSQL replication (e.g., logical replication or physical streaming replication) to keep the standby Control Plane's database in sync with the primary.

## Considerations for Multi-Region[​](#considerations-for-multi-region "Direct link to Considerations for Multi-Region")

Deploying across regions introduces several challenges that must be addressed:

* **Data Replication**: Ensure your PostgreSQL database and any persistent storage are replicated across regions with minimal lag.
* **Latency**: Minimize cross-region communication between components (CP and DP) to reduce latency and improve performance.
* **Configuration Consistency**: Use GitOps and ADC to ensure all regions have the same gateway configurations.
* **Network Connectivity**: Establish secure and reliable networking between regions (e.g., VPC Peering, Transit Gateway, or VPN).

## Implementation Steps[​](#implementation-steps "Direct link to Implementation Steps")

1. **Regional Deployment**: Deploy a complete API7 Gateway stack (CP, DP, and PostgreSQL) in each target region.
2. **GSLB Configuration**: Set up your global load balancer to distribute traffic across regions.
3. **Database Sync**: Configure PostgreSQL replication if using an active-passive pattern or a shared data model.
4. **GitOps Pipeline**: Implement a CI/CD pipeline to deploy the same ADC configurations to all regional Control Planes.

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

* [Multi-AZ Deployment](https://docs.api7.ai/api7-gateway/configure-and-manage/deployment-scenarios/multi-az-deployment.md)
* [Production Best Practices](https://docs.api7.ai/api7-gateway/configure-and-manage/production-best-practices.md)
