Route53 point to other url (e.g. API Gateway endpoint) - amazon-web-services

I have:
Route53 Hosted Zone with DNS example.com.
API Gateway wiht DNS z8n73n8d123.execute-api.eu-west-1.amazonaws.com.
Now if I want to point, lets say, api.example.com or example.com/api (does not matter) to an API Gateway there are at least few ways to do it:
Use an Alias A record in Route53. But before that i need to add BasePathMapping and DomainName attributes to an API Gateway, create a Certificate (which MUST be in us-east-1). Creating certificate in us-east-1 is a deal breaker for me so I can not use it.
Redirect using S3 bucket. But this looks like a shameful workaround introduced by AWS itself. Also additional charges would apply by triggering S3 every time a redirect should take place. So it is again a deal breaker for me.
Use CNAME record???
???
Are there any other viable solutions how to point some-sub-domain.example.com or example.com/whatever to an api gateway?

CloudFront's home region (where its control plane APIs are hosted) is us-east-1, and CloudFront provides the "edge-optimized" feature of API Gateway. This is why -- in "edge-optimized" configuration -- the cert goes in us-east-1, because that's where CloudFront is integrated with Amazon Certificate Manager (ACM).
But if you choose a "regional" API deployment then the certificate goes in ACM in the same region as the API Gateway deployment itself.
See Set Up a Custom Domain Name for a Regional REST API or WebSocket API in API Gateway in the Amazon API Gateway Developer Guide.

Related

Subdomain for AWS API Gateway

I'm currently working on a client project in AWS. We have a REST API with AWS Lambda and API Gateway. The frontend is available via Cloudfront and stored in an S3.
The API should be available under api.client.com and the frontend under admin.client.com.
My problem is that the client's domain is hosted externally and not fully managed in Route53.
Is there a way to get create subdomains (api and admin) in Route53 oder to create an A-Record in the external DNS pointing to API Gateway / Cloudfront?
I would say that you should create a domina named anything in your account and have A records pointing to the API Gateway and the Cloudfront.
These A records you point to from the main domain with cname records.
So in the main domain you have:
api.client.com CNAME api.yourR53domain.com
admin.client.com CNAME admin.yourR53domain.com
In R53:
api.yourR53domain.com A (your api gateway endpoint)
admin.yourR53domain.com A (your frontend endpoint)

AWS Route 53 with AWS API Gateway

Currently I have many AWS Lambda deployed already. And then I think of how to perform Performance Test for each of AWS Lambda. The solution I decided to go is
- Expose each API using AWS Api Gateway for each AWS Lambda
- Use JMeter (Neoload) to perform "performance test" for an API.
The approach is working fine except we need to use a generated endpoint from AWS like https://tl8drdruob.execute-api.us-west-1.amazonaws.com/dev. Now I would like to see if we can use Route 53 to route API or not.
We do have an host zone like abc.awsnonprod.mycompany.net. And I trying to add a record set to that host zone but I don't see any my API Gateway end points listing on Alias Target (API Gateway).
Please advice me if I missing something here.
Thank you
It seems you need to have the custom domain name to map the route 53 to API Gateway.
Please follow Set Up a Custom Domain Name for an API in API Gateway
The API Gateway custom domain feature is very likely what you want. It will create a special/internal Cloudfront distribution which you can use to manipulate the domain and path. You can even relate it to API Gateway stages. Then you could use Route 53 to CNAME or A (alias) your custom domain to the CloudFront distribution.

AWS- I have a CFT that integrates a Lambda Function with API Gateway. What resources do I use to connect my API Gateway to a Custom DNS name?

So I want something like
"example.com/helloworld" to display the Hello World message I have stored in my Lambda Function. My CFN creates a Lambda Function, and creates an API, then connects both of these services.
However, I don't know what resources to use to connect my API Gateway to a Custom DNS name like "example.com/helloworld" so I can display "Hello World" from my Lambda Function in a browser. What resources do I need here?
First step is to go to the "Custom domain names" section of your API Gateway and configure a domain for a particular API and stage. This will instruct the CloudFront distribution that serves your API (API Gateway is always served by a CloudFront in the background) to accept network requests for that domain and forward them to a particular stage (e.g. testing or production). This way you can have different domains instead of URL paths for different stages and use just the endpoint (part after the stage) of the URL.
Then you need to own a domain name (e.g. example.com) and point your domain's CNAME record to the domain that you get when you configure your API Gateway's custom domain.
If your domain is hosted on the AWS Route53 service, you can create just an ALIAS for the domain given to you by the API Gateway instead of the CNAME.
If you are asking for Cloud formation resource for connect APIGW to custom domain name ( or creating a custom domain name in APIGW ) - it is AWS::APIGateway::DomainName
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html

Using custom domain for aws api gateway endpoint in mumbai

I have a aws api gateway hosted in mumbai(ap-south-1). I am trying to add a custom domain to the endpoint.
I created a ACM certificate in the same region and created a Custom Domain Name in the api gateway. The api gateway allowed me to use the ACM certificate only in regionalised(ap-south-1) endpoint configuration and not edge(us-east-1) optimised configuration. This is resulting in a target domain in the format as
*.ap-south-1.amazonaws.com
and not in the cloudfront format like
*.cloudfront.net
After creating the custom domain name(api.mydomain.com) I tried to add it to the hosted zone in route53.
When I try to Create Record Set using target domain in above format(*.ap-south-1.amazonaws.com), I am getting an error
The record set could not be saved because:
- Alias Target contains an invalid value.
I tried by creating the certificate in us-east-1 and creating an edge optimised endpoint. Here I got the cloudfront endpoint. But when I try to access the endpoint, I am getting forbidden exception.
Found that we have to use the certificate from us-east-1(N. Virginia) region and get the cloudfront endpoint it self. I am not sure why they allow regional endpoints if they don't support them in route 53.
For the forbidden error I was not using the correct url(used v1 in endpoint creation).

Enable API Gateway IPv6 on AWS?

I'm using Lambda and API Gateway for building the APIs. And, I read that AWS CloudFront has IPv6 support. I want to use custom domain and I created certificates with ACM as required by the API Gateway.
But, when I test if the AAAA records are found for the CloudFront URL using http://ready.chair6.net, the AAAA records are not found.
Many blog posts assume CloudFront distribution settings are accessible. But, when we create the CloudFront distribution with API Gateway, you can't change settings of the distribution - not from the console.
How do I enable IPv6 for API Gateway?
As a workaround, you can create your own CloudFront distribution, enable IPv6 there, and then point it to API Gateway -- which you will want to deploy using a Regional Endpoint (which avoids having API Gateway creating its own CloudFront distribution) instead of an Edge-Optimized Endpoint (which creates a "hidden" CloudFront distribution controlled by API Gateway).