Marcuzzz
Marcuzzz

Reputation: 93

How to setup custom subdomain for AWS lambda function

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...

Upvotes: 2

Views: 2566

Answers (1)

karjan
karjan

Reputation: 1016

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

Upvotes: 1

Related Questions