Which Is Better: CloudFront with Multiple Origins or API Gateway Custom Domain for API Management?

0
4
Asked By CloudSailor99 On

I'm designing a cloud architecture and I want to use CloudFront in front of multiple API Gateway endpoints, ideally maintaining a single domain while routing requests to different API Gateways based on the path. I've got two main options to consider: 1) Setting up a custom domain with path mappings for both API Gateways under one domain, or 2) Configuring CloudFront to use multiple origins, linking each API Gateway to different path patterns. My primary focus is on performance. Has anyone else tackled this challenge, and if so, which method provided better performance? I'd love to hear your experiences, especially at scale. Here are some diagrams to illustrate both options: Option 1 uses a single domain with path mappings directing to each Gateway, while Option 2 directly connects CloudFront to the separate Gateways based on service paths.

4 Answers

Answered By APIWhisperer14 On

I’d suggest using multiple origins with path-based routing for clarity and better management of your APIs.

Answered By QueryMaster3000 On

Is your API content cacheable? That’s something to consider because CloudFront will only help with performance if there’s cacheable content involved. If the slow part of your API is non-cacheable, then having CloudFront in front may not provide the performance benefits you want. It does help with having a single domain and CORS issues, but you might not achieve the speed improvements you're looking for.

Answered By TechGuru77 On

I lean towards option two, using CloudFront with two separate origins. It seems to be the most straightforward and logical choice. I’m not convinced there’s much of a performance difference between the two options unless you consider your user base's global spread. If your users are worldwide, then having an edge-optimized API might enhance performance, but that depends on your actual API setup under the hood.

Answered By DevDude88 On

If performance is your top concern, then definitely go with option two. It’s more efficient for managing multiple API Gateways.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.