h. Setup Custom Domain 🔗

Custom domains are a great way to shorten the default API Gateway domain into something more readable. For example instead of https://sdrojbaf64.execute-api.us-east-2.amazonaws.com/ users could navigate to, for example, example.com.

Before getting started ensure that you:

  • Own a Domain
  • Know how to change basic DNS settings

We’ll be referring to example.com only as an example in the following steps. Use your domain when you see this.

Create new Domain in API Gateway

  1. Navigate to API Gateway Console > Custom domain names > Create

    Create Domain

  2. If you haven’t already created a certificate, you can do that through ACM by clicking “Create new certificate in Amazon Certificate Manager”. If you already have a cert, skip to Setup API Mappings.

Create certificate

  1. On the Certificate Manager console, click “Request”

  2. Enter in the domain you own, i.e. example.com

  3. Select either email or DNS validation (I prefer email)

  4. Click request

    Request Certificate

If you selected email, you’ll get an email to the email you have on file with the regisitrar. Click “I approve” to activate the certificate.

Setup API Mappings

Return back to the API Gateway console, select the certificate and click “Create” to complete the setup.

  1. Next on the API Gateway > Custom domain names > your domain

  2. Click on Configure API Mappings and create a new one like:

    API Gateway Custom Mappings

You’ll see a section called API Gateway domain name. Copy that for DNS setup.

Setup DNS

Create a DNS CNAME rule that points your domain to the API Gateway domain like so:

Rule Source Destination
CNAME example.com d-hb4qd1edp8.execute-api.us-east-2.amazonaws.com.

Note: this is not the same as the URL you access when you go to PCM. Check API Gateway > Custom Domains > API Gateway domain name for the correct domain.

Add the domain to your Cognito user pool

  1. Navigate to the Cognito Console > Select your user pool

  2. Under App Integration > Domain > Create custom domain

    Cognito Custom Domain

  3. Enter in the same domain as before and select the certificate

Configure API Gateway Callback URL

  1. Navigate to Cognito > App Integration > App clients and analytics. There you’ll see an application, click on it and scroll down to Hosted UI.

  2. Edit the section and add in i.e. example.com/login under the Allowed Callback URLs section:

    Hosted UI

Configure AWS Lambda Function

  1. Go to the Lambda Console (deeplink) and search for ParallelClusterUIFunction

  2. Select the function then Configuration > Environment Variable. Edit SITE_URL to point to the domain you setup:

    Hosted UI

Test

  1. Navigate to your domain, i.e. example.com and authenticate, you should now be connected to ParallelCluster UI using your own domain.