Reputation: 5092
I have a lambda function in all AWS regions. I have clients throughout the globe who will make a POST call to my base domain example.com
. It is the responsibility of my (kind-of) load-balancer to make sure that the requests are routed to the API gateway of the region which is closest to the client, in order to minimize the latency.
So, far I have the following configuration:
us-west-1.example.com
configured and a mapping of the path which calls my lambda. The CloudFront URL for this API gateway is d12345123.cloudfront.net
A
in the Route53 hosted zone for us-west-1.example.com
which is an alias of d12345123.cloufront.net
. If I make a POST call to us-west-1.example.com/1.0/localdb
, it returns me the correct output.default.example.com
of A
type, which has a geo-proximity rule assigned to it, which redirects the traffic to the CloudFront instance (the same instance which is exposed after adding the custom domain name in that region) of the region. This creates an entry for default.example.com
in the hosted zone of type A
A
in the Route53 hosted zone for example.com
which is an alias to default.example.com
, so that the traffic which comes to example.com
can be routed to default.example.com
After these configurations, when I make a call to example.com
, I receive a 403
response from Cloudfront, calling it a Bad Request
Thanks
Upvotes: 1
Views: 7505
Reputation: 211
As of Nov 2017 "Amazon API Gateway Supports Regional API Endpoints"
You can now choose from two types of API endpoints when creating REST APIs and custom domains with Amazon API Gateway. A regional API endpoint is a new type of endpoint that is accessed from the same AWS region in which your REST API is deployed. This helps you reduce request latency when API requests originate from the same region as your REST API. Additionally, you can now choose to associate your own Amazon CloudFront distribution with the regional API endpoint. The second type of API endpoint is the edge-optimized API. Edge-optimized APIs are endpoints that are accessed through a CloudFront distribution that is created and managed by API Gateway. Previously, edge-optimized APIs were the default option for creating APIs with API Gateway.
To get started, create a new REST API using the Amazon API Gateway console, AWS CLI, or AWS SDKs and APIs. You can also migrate existing REST APIs and custom domains to a regional API endpoint. Visit our documentation to learn more about this feature.
This feature is now available in US East (N. Virginia), US East (Ohio), US West (Oregon), US West (N. California), Canada (Central), South America (São Paulo), EU (Ireland), EU (Frankfurt), EU (London), Asia Pacific (Singapore), Asia Pacific (Tokyo), Asia Pacific (Sydney), Asia Pacific (Seoul), and Asia Pacific (Mumbai) AWS regions. Visit our product page for more information about Amazon API Gateway.
Upvotes: 1