Search code examples
amazon-web-servicesaws-lambdaaws-api-gatewaygodaddy-api

configure base domain url (site.com without www for example) to api gateway, and make it work from within the browser


I'm trying to create the shortest URL for unsubscribing messages. It should look like -

site.com/f3v4g1

This should result in calling an AWS Lambda function through AWS API Gateway. For that to happen, I need to set an A record in the DNS (in my case GoDaddy) and point to the API Gateway. The API Gateway has a custom domain name configured pointing to xxxnxxx.cloudfront.net.

Problem is that the A record requires a static IP.

Another try I did, with GoDaddy Forwarding option, but that will also not work, as it forwards the request to xxxnxxx.cloudfront.net, and it fails with a forbidden error, probably because the host is incorrect (it is expected to be executed from site.com).

Any idea how it can be done? Any simple AWS solution for that - that doesn't require a server with a static IP ;).

Thanks


Solution

  • Move your DNS authoritative servers to Route 53, then use an ALIAS record there.

    Only Route53 can properly resolve apex domain records in this way.

    You can retain GoDaddy as your registrar if required. But assign the AWS DNS servers to the custom domain NS records in GoDaddy manage domains.