Enable https and a custom domain name for API Gateway on AWS

In a previous blog I demonstrated how to create a java REST application using AWS Lambda and API Gateway.

In this blog we will modify the API Gateway so we can access the REST endpoint using a custom domain name and use https.

  • Open the API Gateway console and select ‘Custom Domain Names’ from the left menu
  • Press the ‘create new custom domain name’ button and use the following values:
    • domain name: example.api.vdzon.com
    • endpoint: edge optimized
    • certificate: choose the certificate for example.api.vdzon.com (see step 1 in this blog on how to create a certificate)
    • add basemapping:
      • path: /
      • destination: choose the lambda function
      • stage: select the stage to use
    • save the ‘Target Domain Name’
  • Wait until the Custom Domain Name that we created in AWs is finished initializing (may take 40 minutes)
  • While waiting: create a DNS entry on your DNS Service Provider
    • domain name: example.api.vdzon.com
    • type: CNAME
    • value: the target domain name as stored in the previous step

The endpoint can now be called on https://example.api.vdzon.com/