Custom Domain & SSL

Next, we need to configure the domain for the API Gateway we just created. We’ll proceed to create a custom domain and configure SSL for that domain using AWS Certificate Manager.

Create a Certificate

  1. Search for and access AWS Certificate Manager on the Console.
    • Click Request a certificate.

ACM

  1. On the Request certificate screen:
    • Select request a public certificate.
    • Click Next.

ACM

  1. On the Request public certificate screen:
    • Enter the domain name in the Fully qualified domain name field.
    • In the Validation method section, select DNS validation.

ACM

  • In the Key Algorithm section, choose RSA 2048.
  • Click Next to complete the setup.

ACM

  1. On the Certificate detail screen:
    • Click Create Records in Route 53.
    • Once on the create records screen, click Create Records to initiate.
    • Then, wait for the verification to turn green, indicating successful creation.

ACM ACM ACM

Create a Custom Domain

  1. On the API Gateway screen, select Custom Domain Names:
    • Click Create.

ACM

  1. On the Create domain name screen:
    • Enter your domain name in the domain name field.
    • Select the API endpoint type: Regional.
    • In the ACM certificate section, choose the ACM you set up earlier.
    • Click Create Domain Name.

ACM ACM

  • In the API Gateway Domain Name section, this will be the domain you configure in Route 53 to map your custom domain.

ACM

  1. On the Custom domain names screen:
    • Select the domain you just created.
    • Go to the API Mappings tab.
    • Click Configure API Mappings.

ACM

  • Select the API in the API field.
  • Choose the stage you want to map, in this case, I’ll select the default stage.
  • Click Save.

ACM

Map Domain Name

  1. Search for and access AWS Route 53.
    • Go to Hosted Zones in the navigation bar.
    • Select the Hosted Zone of your domain.

ACM

  1. On your domain’s hosted zone screen:
    • Click Create Record.

ACM

  1. On the Create Record screen:
    • Enter your subdomain in the record name field.
    • Choose CNAME as the Record Type.
    • Enter the API Gateway Domain Name in the Value field.
    • Click Create Records.

ACM

That’s it! Now, we can test if everything is working using cURL.

ACM

It seems everything is set up correctly. The setup is now complete.