Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Custom Domain Name for Lambdas

Tags:

I'm working with AWS Lambdas and I deploy them using Serverless. Everytime I deploy any function I receive this kind of URL to hit the service:

https://mh6r122dq1.execute-api.us-east-1.amazonaws.com/{stage}/{function}

where 'stage' is either dev or qa, and 'function' is the name of my lambda function.

I'm trying to access to my lambdas using a more friendly URL. I followed this tutorial from AWS docs:

http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html

I can not make it work. I have already the certificates created, my company did it. So to me, this just needs to be as simple as select the name of your domain and attach it to your Lambda API gateway.

These are the steps I'm doing:

1) I create a Custom Domain Name here https://console.aws.amazon.com/apigateway/home?region=us-east-1#/custom-domain-names. The page offers me automatically the certificate. I'm using some made up name like my.service.com. I also tried using a fully qualified domain name from my company which is hosted in our AWS account. None of both worked.

2) Then from the same page I select the base path, the destination (which is my lambda) and the stage. After saving it, the page provides me with a value called 'Distribution Domain Name', it looks like abc123def456.cloudfront.com.

3) Then I go to Amazon 53 and I create a new Hosted Zone. Again, I'm sure here if I need something totally made up or a real domain. Then I create a new A record for a ip address, I mark Alias-true, and I put the value from above "Distribution Domain Name"

And that's it. Those are the steps I'm doing. Then when I tried to hit my Lambda, I followed the instructions from the page I put above in the section "Root URLs of APIs with default and custom domain names".

I followed this process a couple of times and I'm really wondering if that page is ok. When I hit my lambdas with the custom domain name I get a 404 or a "can not resolve this host".

Does anyone have followed that process from that page from AWS and had good results?

UPDATE Thu Jul 13 12:23

Here are some pictures of my settings:

My custom domain name

enter image description here

enter image description here

I get "Could not resolve host" either for qa-lambda.lqwebservices.com or rateloader.qa.lqwebservices.com

like image 639
Perimosh Avatar asked Jul 13 '17 03:07

Perimosh


1 Answers

"Again, I'm sure here if I need something totally made up or a real domain" you need a real domain name. Also since you needed to create a new hosted zone, that means your company does not currently use AWS Route 53 for their DNS. You'll have to point something like api.company.com to abc123def456.cloudfront.com from whatever domain registrar your company uses.

like image 81
ricka Avatar answered Sep 21 '22 14:09

ricka