Regional/Edge-optimized API Gateway VS Regional/Edge-optimized custom domain name
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
API Gateway is an essential service provided by cloud platforms to facilitate easy and seamless communication between clients and services. AWS API Gateway, in particular, offers two types of API deployments that are highly effective under different circumstances: Regional and Edge-optimized endpoints. Additionally, AWS allows the use of custom domain names for these APIs, offering better branding and ease of access. This article will delve into the technical intricacies of both Regional and Edge-optimized API Gateways, comparing them in terms of performance, use cases, and the significance of using custom domain names for them.
Regional vs Edge-optimized API Gateway
Regional API Gateway
Regional API endpoints are intended to be used directly by clients within the same AWS Region. These APIs are effective in scenarios where the user base and the backend services are situated within the same geographical region, thus minimizing latency by maintaining proximity between resources.
Key Features
- Low Latency: Localized requests ensure lower latency due to reduced network hops.
- Cost Efficiency: As data is not transferred between regions, networking costs are diminished.
- Control Over Data Flow: Ideal for scenarios where data residency is a concern, as data doesn't leave the specified AWS Region.
Edge-optimized API Gateway
Edge-optimized API endpoints use the Amazon CloudFront content delivery network (CDN), which automatically routes requests to the nearest geographical edge location. This type of endpoint is advantageous when APIs are meant for a globally distributed client base.
Key Features
- Global Reach: Ensures that users worldwide experience minimal latency, as requests are routed through the closest edge location.
- Caching: The CDN caches responses to reduce load and improve response time for repeated requests.
- Automatic Scalability: Built-in CloudFront edge services provide automatic scalability based on demand.
Custom Domain Names for APIs
Custom domain names provide a branded URL for accessing API Gateway endpoints, which can enhance user experience and offer better integration into existing systems.
Technical Considerations
- Certificate Management: Custom domains require an SSL/TLS certificate managed via AWS Certificate Manager (ACM).
- Route Settings: Requires configuration of DNS settings in your domain name provider to map the custom domain to the AWS API Gateway.
- Path Mapping: Allows path configuration to route requests to different stages or regions.
Regional vs Edge-optimized Custom Domain Names
When configuring a custom domain name for either endpoint type, certain configurations vary by necessity:
- For Regional APIs, the custom domain setup maintains a direct link to the specified AWS Region's API Gateway.
- For Edge-optimized APIs, the custom domain relies on CloudFront distribution, affecting DNS configurations differently.
Example Scenarios
To further illustrate, consider the following scenarios:
Scenario 1: An Online Retailer
A retailer with a major concentration of customers in North America should deploy a Regional API Gateway in the US-East or US-West Region. This approach optimizes for latency by keeping all transactions localized to a single region.
Scenario 2: A Social Media App
A social media platform with a global audience benefits from an Edge-optimized API Gateway. Given the widespread user base, routing through edge locations ensures that users access APIs with minimal delay, irrespective of their geographical location.
Summary Table
Here is a summarized comparison of the two deployment options:
| Feature | Regional API Gateway | Edge-optimized API Gateway |
| Latency | Low for local clients | Low for global clients |
| Networking Costs | Lower costs with regional clients | Higher due to CloudFront fees |
| Scalability | Scales within a region | Automatically scales globally |
| Cache and CDN | No CDN by default | Uses Amazon CloudFront |
| Use Case | Localized user base | Globally scattered user base |
| Custom Domain Configuration | Regionally specific DNS settings | Uses CloudFront distribution |
| Data Residency Compliance | Region-specific data flow control | Global data flow |
Conclusion
Choosing between a Regional or Edge-optimized API Gateway involves understanding your application's geographic user distribution and performance requirements. While Regional APIs are economical and compliant with data residency laws, Edge-optimized APIs offer an unrivaled global reach with reduced latency. Coupling these endpoint types with custom domains delivered through AWS facilitates a professional and seamless interaction, ensuring an enriched end-user experience. Whether your API’s primary audience is local or spread across continents, AWS API Gateway services are robust enough to cater to all needs.
Related reading
- Reliable Webhook dispatching system
- Replacing tf.placeholder and feed_dict with tf.data API
- Repository not necessary when implementing JpaRepository?
- Request payload limit with AWS API Gateway
- Relating NP-Complete problems to real world problems
- Relationship between loss and accuracy
- Request validation using serverless framework
- RequestBody is getting null values

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.