API Gateway
Custom Domain Name
Edge Optimization
Regional Optimization
Cloud Architecture

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.

Practice system design

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:

FeatureRegional API GatewayEdge-optimized API Gateway
LatencyLow for local clientsLow for global clients
Networking CostsLower costs with regional clientsHigher due to CloudFront fees
ScalabilityScales within a regionAutomatically scales globally
Cache and CDNNo CDN by defaultUses Amazon CloudFront
Use CaseLocalized user baseGlobally scattered user base
Custom Domain ConfigurationRegionally specific DNS settingsUses CloudFront distribution
Data Residency ComplianceRegion-specific data flow controlGlobal 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
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track 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.

Practice system design

All Rights Reserved.