How to create route53 record for AWS Gateway API - amazon-web-services

I have existing hosted zone and A record in AWS route 53. The A record is pointing to cloudfront distribution.
lets say the hosted zone name is abcd.ci.example.io. The A record name is same as hosted zone. I can access the web site at abcd.ci.example.io without any issue.
I also have AWS Gateway API with invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev I can access a particular API route from the browser using invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev/v1/healthcheck
I want to assign a custom domain name to invoke url. So I created a new CNAME record in the hosted zone as api.abcd.ci.example.io and set the value to https://xxxxx.execute-api.us-west-2.amazonaws.com/dev
But then when I try to access a route using https://api.abcd.ci.example.io/v1/healthcheck I get error This site can’t be reached
A simple command line ping to api.abcd.ci.example.io also returns error as Ping request could not find host api.abcd.ci.example.io. Please check the name and try again.
Below is list of records in hosted. There are couple of acm validation records as well for both the domains.

Before API Gateway will let you point your custom domain to it, you first have to setup the custom domain in API Gateway, which includes setting up the SSL certificate API Gateway will use for that custom domain.

Related

How to setup custom subdomain for AWS lambda function

Steps I've taken so far:
I've deployed a lambda function which got me to this endpoint https://#############.amazonaws.com/dev/{action} (using serverless)
I've setup a certificate with AWS Certificate Manager for my subdomain. Added the CNAME name & value to my DNS info at my domain name provider and after a while the certificate was issued.
I've setup AWS API Gateway -> Custom Domain names -> Added my subdomain and added an API mapping.
Now I'm stuck I've tried several things:
A. DNS settings at my domain provider: Pointed my a subdomain using "cname" to the endpoint of the lambda function.
B. Looked at AWS Route 53 and tried several combinations... adding the domain and a subdomain / adding the subdomain directly and tried to set the dns settings for my subdomain at my domain provider to "aws route 53" with a record / cname / ips / txt etc...
To assign custom domain name to API gateway, you should assign Alias record. Look here https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-api-gateway.html
But from what you've written I'm not sure if you created Lambda function with connected API Gateway or Lambda with function URL. The difference is well defined here https://www.serverless.com/blog/aws-lambda-function-urls-with-serverless-framework

How to point AWS API Gateway URL to Google domains subdomain?

I need create a custom url for my aws api gateway. My domain example.com is managed by google domains. Now I need to link my api which has an aws url like xxxxxxxxxx.execute-api.us-east-1.amazonaws.com to a custom subdomain like api.exemple.com .
exemple.com is already setup in google domains. Now I need to add the subdomain. I tried to add :
host name : api.example.com
type : CNAME
ttl : 10 minutes
data : xxxxxxxxxx.execute-api.us-east-1.amazonaws.com
But it doesn't work as I get this following error from postman when testing the new address :
with https
Error: write EPROTO 140376973400152:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:
with http
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
Any suggestion ?
Ok maybe this isnt the only way to do it but this is how iv done it before.
First you need to set up and Elastic IP that is linked to your EC2 Instance.
Once you have the IP set up you can then go to Route 53 in your AWS console and set up a hosted zone.
In this hosted zone that you create you would pout the Domain name as api.exemple.com and leave public hosted zone checked and click create hosted zone. Once this zone is created you would go into that zone and click create record which then you will put the elastic IP as the Value area and leave everything as is and click create records.
Once this is done you can go to google and create a A record where api.example.com point to the Elastic IP address.
Sorry i hope this helps i know its a bit confusing but i got it to work this way.

Route subdomain to AWS api gateway

Hello I´m using Cloudflare to manage my domain DNS and I want to route
test.domain.com to an AWS rest api gateway. is that possible? or I need to fully host the domain in route53?
I tried with
created lambda function
created api gateway (with Authorization set to NONE)
created a certificate for the domain
created the custom domain in api gateway
now when I go to test.domain.com I see
{
message: "Forbidden"
}
Yes of course you can do this, if you setup a custom hostname in API Gateway with the domain name as your subdomain you will be given a DNS name. When you configure this you will add a path binding to a stage in API Gateway which will then route traffic to your deployment.
You would then assign this as the value to your DNS CNAME record for your subdomain.
More information about setting up a custom domain name is available here.

Custom Domain for API Gateway not able to set 404

I am trying to setup a custom domain endpoint for API gateway published endpoint but not able to set.
I've followed all steps
Custom domain DNS is managed by AWS (aws cannot own this as its a .ai URL)
Created ACM Certificate for subdomain. (subdomain.host.ai)
Add Custom API in API Gateway with Mapping to particular Stage
Add A record for custom domain to point to "d-abcde12345.execute-api.us-west-2.amazonaws.com"
What might be going wrong.
When you are pointing to a DNS hostname, rather than an IP, you need a CNAME record. More importantly, when you assign a custom domain to your API Gateway, it will create a CloudFront distribution for you and gives you a CloudFront endpoint: E123CNFSOMETHING.cloudfront.net. You need to create a CNAME record in your registrar dashboard to point to this address, not the API Endpoint:
FROM TO TTL
subdomain E123CNFSOMETHING.cloudfront.net. 300

Unable to map custom domain to API Gateway (from Godaddy)

I'm trying to set up a custom domain (say, myapi.com) for my API Gateway but am running into problems. The domain is currently registered on GoDaddy. So far, I've followed this tutorial and done the following:
Obtained a certificate for myapi.com and *.myapi.com from the AWS Certificate Manager.
Mapped the domain myapi.com (not *.myapi.com as I don't need it yet) to an API in the API Gateway.
Added a CNAME entry for the resulting "target domain name" in GoDaddy.
Here are the screenshots:
Now here's the problem: When I do ping myapi.com I get: No address associated with hostname. I'm not sure what's causing this, so would really appreciate some help. And while we're at it, are there any other steps I need to perform before this works as expected?
You cannot use a CNAME record at the apex or domain root with standard DNS services. I suggest you try using a hostname for your endpoint and using the CNAME there eg api.example.com.
Alternatively, you can move your DNS to Route 53. The Route 53 system does support aliases at the root domain level, using the Alias record type.
For more information on Alias records in Route 53 see https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html