Search code examples
aws-lambdaaws-api-gatewayserverlessaws-certificate-manager

AWS API Gateway Custom domain is trying to resolve the wrong certificate


DevOps rookie here.

I have a serverless app deployed on AWS. On deployment, it issued the API url: https://{id}.execute-api.{zone}.amazonaws.com

(My domain is managed on godaddy.) I am trying now to route the api gateway url to my custom domain.

The steps I did:

  • I added a CNAME in Godaddy that creates my custom domain to be an alias for the https://{id}.execute-api.{zone}.amazonaws.com
  • I have created a Custom Domain record in the AWS API Gateway, issued a certificate in AWS Certificate Manager for my custom domain
  • A have mapped the api gateway domain to the custom domain through API Gateway -> Custom domain names -> Select custom domain name -> API mappings

Now I am trying to access the custom domain, using Postman and I get: enter image description here

It looks like is not pointing to the right certificate. Can someone point me to the right direction or what needs to be fixed?


Solution

  • When you create a Custom Domain, it will provide an "API Gateway domain name" which you will find in the "Custom domain names" >> "Configuration" tab of the API gateway.

    You have to add a certificate to this and also you have to map your domain with this API Gateway domain name.

    Note: Don't forget to Map your API in "API mappings". Add your API gateway and Stage both.

    https://mbio.medium.com/setup-a-custom-domain-name-with-aws-api-gateway-d26e9ccd6a5 this will also help