Paul Allies
Posted on May 7, 2021
Let's hook up the name myapp.nanosoft.co.za to an AWS API Gateway
Create Certificate for Domain
- Go to the Certificate Manager console
- Request a certificate
- Select "Request a public certificate"
- Add one or more domain names, in my case I add myapp.nanosoft.co.za
- Choose DNS validation
- You'll be given a CNAME entry to which you'll need to register at your DNS Registrar e.g:
HOST: _xxxxxxxxxxxxxxxxxxxxx.myapp.nanosoft.co.za
TYPE: CNAME
VALUE: _xxxxxxxxxxxxxxxx.xxxxxxxxx.acm-validations.aws.
This is necessary to validate that you own the subdomain
- Test the DNS Validation registration with
$> dig +short _xxxxxxxxxxxxxxxxxxxxx.myapp.nanosoft.co.za
you should get a response of
_xxxxxxxxxxxxxxxx.xxxxxxxxx.acm-validations.aws.
- Once AWS has found this validation token, you'll notice that the certificate manager will update the status of the certificate from "Pending" to "Issued". Next, let's create an API Custom Domain record
Create a custom Domain
- Go to the API Gateway console
- Go to Custom domain names and create a domain name
- Choose TLS 1.2
- Regional Endpoint
- Choose the newly created Certificate for myapp.nanosoft.co.za
- Click "Create Domain Name"
Link the Domain Name to Rest API
- Go to the API Gateway console
- Go to Custom domain names
- Select myapp.nanosoft.co.za
- Configure the API mapping by choosing an API and Stage, Path is optional
- Save mapping
Link the Domain Name to Rest API
- Go to the Route 53 console
- Create a Hosted Zone, In my case it would be nanosoft.co.za
- Create an A Record for a subdomain by choosing Simple Routing
- add the subdomain myapp to the existing nanosoft.co.za domain
- Choose "A record"
- For Value/Route to, choose "Alias to API Gateway API"
- Choose the region where the api exists, in my case af-south-1
- Choose the matching API gateway, e.g. d-xxxxxx.execute-api.af-south-1.amazonaws.com
- Click "Define simple record"
- Now that you have this A Record, we need a CNAME in our DNS to link the subdomain. Do so by adding a CNAME record at your DNS Registrar
Host: myapp, //or myapp.nanosoft.co.za depending on your DNS Registrar
Type: CNAME,
Value: d-xxxxxx.execute-api.af-south-1.amazonaws.com
- Test the dns propagation with https://dnschecker.org/#CNAME/myapp.nanosoft.co.za
💖 💪 🙅 🚩
Paul Allies
Posted on May 7, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.