AWS
API Gateway
Certificate Manager
Custom Domain
Cloud Services

Can I use AWS Certificate Manager certificates for API Gateway with Custom Domain Name

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

To integrate AWS Certificate Manager (ACM) certificates with API Gateway using a custom domain name, several technical aspects should be considered. This process involves multiple AWS services, including AWS ACM, API Gateway, and Route 53. Below, we provide a comprehensive guide detailing how to set up ACM certificates for API Gateway with a custom domain name, accompanied by examples and key points in a tabular format.

AWS Certificate Manager Overview

AWS Certificate Manager simplifies the process of managing SSL/TLS certificates for your AWS services. It helps you handle the provisioning, validation, renewal, and deployment of certificates effortlessly. This ensures encrypted data exchanges to help protect communications between clients and your API Gateway.

Using ACM Certificates with API Gateway

Prerequisites

  • Custom Domain Name: You need a custom domain name registered via Route 53 or an external registrar.
  • API Gateway Setup: An API created and deployed in AWS API Gateway.
  • AWS ACM: Set up in your AWS account with an SSL/TLS certificate issued through ACM.

Steps to Use ACM Certificates with API Gateway

  1. Request a Certificate in ACM:
    • Navigate to AWS ACM in the AWS Management Console.
    • Request a public certificate and ensure it covers your desired domain. Use either DNS or email validation to verify domain ownership.
    • Example: For a domain `api.example.com`, request a certificate that includes `api.example.com`.
  2. Create a Custom Domain in API Gateway:
    • Open the API Gateway console and select "Custom domain names" from the left-panel.
    • Click "Create" and enter your domain name.
    • Choose a Regional custom domain name for HTTP APIs or a specific regional endpoint for REST APIs.
    • Select the ACM certificate you've created.
  3. Configure DNS Settings:
    • If using Route 53, automatically create an alias record that points your custom domain to the API Gateway hostname.
    • For non-Route 53 domains, manually configure a CNAME record that directs traffic to the endpoint provided by API Gateway.
  4. Map the API Stages to the Custom Domain:
    • Navigate back to the "Custom domain names" section.
    • Choose your custom domain and map API stages through "API mappings."

Technical Considerations

  • Certificate Validation: Ensure the domain is validated. Without successful validation, the certificate can't be deployed.
  • Propagation Delay: DNS changes may take time to propagate globally. Be patient if the custom domain name doesn't resolve immediately.
  • Regional Backends: Choose Regional endpoints if your API clients are spread across the globe. Use edge-optimized endpoints for regional deployments.

Example Scenario

Suppose you have a sample API running in API Gateway that you want to associate with `api.example.com`:

  1. Request and validate a certificate for `api.example.com`.
  2. Create the custom domain name and associate it with the ACM certificate.
  3. If using Route 53, set up an alias record for `api.example.com`:
    • Record Name: `api.example.com`
    • Type: A - IPv4 address
    • Alias: Yes
    • Target: API Gateway's provided endpoint
  4. Map your API Gateway stage (e.g., `prod`) to the custom domain.

Your API will now be accessible through the custom domain with the assurance of ACM-managed security.

Summary Table

Below is a summary of the core steps and considerations:

StepDescription
Certificate RequestUse ACM to request a public certificate for your domain
Domain ValidationValidate ownership via email or DNS
Custom Domain SetupConfigure custom domain in API Gateway and select the ACM certificate
DNS ConfigurationSet up appropriate DNS records using Route 53 or another provider to point to the API Gateway
API MappingMap API Gateway stages to your custom domain name
Latency ConsiderationUtilize edge-optimized endpoints for latency-sensitive applications

Additional Details

Security

  • Renewals: ACM automatically renews certificates before their expiration date. Ensure that your DNS configuration supports ACM's renewal process.
  • HTTPS Enforcement: Enforce HTTPS in your API Gateway settings to ensure secure connections.

Troubleshooting

  • Common Errors: Misconfigured DNS records frequently result in connectivity issues. Double-check hostname patterns and certificate validation statuses.
  • ACM Logs: Use AWS CloudTrail to trace actions performed with ACM for enhanced troubleshooting.

By following the outlined steps and considering technical specifics and configuration details, you'll be able to leverage AWS Certificate Manager capabilities effectively in your API Gateway deployment with a custom domain name.


Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design