8

I have a lambda-backed api gateway that i deployed in two regions. These two API's are totally identical. I have two different URL's like

*.execute-api.us-east-1.amazonaws.com *.execute-api.eu-west-1.amazonaws.com

My idea was defining the same custom domains in two regions and using Route53 geolocation feature, serving the api from the nearest region to the user. But, after defining the custom URL in one region, when I try to define in the second region I get an error saying that this domain is already defined in another cloudfront distribution.

Is this a bug or which strategy can i follow to multi-region deployment of API Gateway.

Thanks.

3 Answers3

1

Unfortunately, this is not currently possible. The primarily blocker here is CloudFront. MikeD@AWS provides the info on their forums:

When you create a custom domain name it creates an associated CloudFront distribution for the domain name and CloudFront enforces global uniqueness on the domain name.

If a CloudFront distribution with the domain name already exists, then the CreateCloudFrontDistribution will fail and API Gateway will return an error without saving the domain name or allowing you to define it's associated API(s).

Thus, there is currently (Jun 29, 2016) no way to get API Gateway in multiple regions to handle the same domain name.

AWS has no update on providing the needful since confirming existence of an open feature request on July 4, 2016. AWS Form thread for updates

cixelsyd
  • 291
  • 1
  • 4
0

The way we have somewhat solved this is to actually front it by cloudfront. Then in cloudfront you add both end points as origins.

Notme
  • 1
0

I have a couple of ideas.

CloudFront as has been said above, you can't load balance with CloudFront. So your options would seem to be

  1. Use a single origin with CloudFront. Latency of 85ms between the US East and West Coasts isn't so bad. Compared with the latency between where I live (New Zealand) and the USA of up to 250ms it's fairly small.
  2. Remove CloudFront, use Route 53 latency based routing to directly hit the API gateway. With this you could use as many regions as you like - add one in Sydney / Asia if you have customers down there.
Tim
  • 33,870
  • 7
  • 56
  • 84