1

Steps I've taken so far:

  1. I've deployed a lambda function which got me to this endpoint https://#############.amazonaws.com/dev/{action} (using serverless)
  2. 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.
  3. I've setup AWS API Gateway -> Custom Domain names -> Added my subdomain and added an API mapping.
  4. 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...

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Marcuzzz
  • 83
  • 1
  • 8

1 Answers1

1

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

karjan
  • 936
  • 1
  • 7
  • 17
  • Thanks John, I'm not using function URL but good that you brought it up. I've created the custom domain at Route53. Only question I now have is where do I point my A record or CNAME from my domain name provider? – Marcuzzz Sep 20 '22 at 08:38
  • I'm not sure why you call me John, but let's go with it. Alias record is an AWS abstract concept, it's not easily mappable to standard DNS. Some of the providers, like namecheap, support it, but not all. You might have to migrate your domain to AWS. https://www.namecheap.com/support/knowledgebase/article.aspx/10128/2237/how-to-create-an-alias-record/?gclid=CjwKCAjwyaWZBhBGEiwACslQo3ACbjVoBSFhZubywzvltilAtOUhjKEPILre4Yayr3o1TyfLMZJd3RoCQQMQAvD_BwE For standard DNS, you could use Network Load Balancer with static IP, in front of ALB routing to lambda. But that's a lot of complexity – karjan Sep 20 '22 at 08:54
  • My apologies Karjan, above your answer another name is shown (on my end) "John Rotenstein" I think I now understand it a little bit better, why it's not working for me. All though technically, what doesn't make sense to me is why you wouldn't be able to do this: mybelovedsubdomain.example.com NS ns-648.awsdns-17.net.;ns-1206.awsdns-22.org.;ns-200.awsdns-25.com.;ns-2009.awsdns-59.co.uk. some how... or a CNAME / A Record for that matter... Thanks – Marcuzzz Sep 20 '22 at 09:13
  • Because A or CNAME has to point to an IP. ALIAS record was built to remedy that and work with dynamic range of IP addresses. And Api Gateway can't provide a static IP – karjan Sep 20 '22 at 11:20
  • `CNAME has to point to an IP.` Absolutely not true, and quite the contrary in fact. The problem is that a CNAME can't exist at apex. Various providers have added proprietary and non standard records to go around that. – Patrick Mevzek Sep 20 '22 at 14:13