Configures an edge-optimized API Gateway with an ACM certificate and sets up a corresponding DNS record using Route53.

Terraform Template

resource "aws_api_gateway_domain_name" "example" {
  certificate_arn = "aws_acm_certificate_validation.example.certificate_arn"
  domain_name = "api.example.com"
}

resource "aws_route53_record" "example" {

  alias {
    evaluate_target_health = true
    name = aws_api_gateway_domain_name.example.cloudfront_domain_name
    zone_id = aws_api_gateway_domain_name.example.cloudfront_zone_id
  }
  name = aws_api_gateway_domain_name.example.domain_name
  type = "A"
  zone_id = "aws_route53_zone.example.id"
}