AWS App Runner Custom Domain Association

This page shows how to write Terraform for App Runner Custom Domain Association and write them securely.

aws_apprunner_custom_domain_association (Terraform)

The Custom Domain Association in App Runner can be configured in Terraform with the resource name aws_apprunner_custom_domain_association. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


The following arguments supported:

  • domain_name - (Required) The custom domain endpoint to association. Specify a base domain e.g., or a subdomain e.g.,
  • enable_www_subdomain (Optional) Whether to associate the subdomain with the App Runner service in addition to the base domain. Defaults to true.
  • service_arn - (Required) The ARN of the App Runner service.

In addition to all arguments above, the following attributes are exported:

  • id - The domain_name and service_arn separated by a comma (,).
  • certificate_validation_records - A set of certificate CNAME records used for this domain name. See Certificate Validation Records below for more details.
  • dns_target - The App Runner subdomain of the App Runner service. The custom domain name is mapped to this target name. Attribute only available if resource created (not imported) with Terraform.

Explanation in Terraform Registry

Manages an App Runner Custom Domain association.

NOTE: After creation, you must use the information in the certification_validation_records attribute to add CNAME records to your Domain Name System (DNS). For each mapped domain name, add a mapping to the target App Runner subdomain (found in the dns_target attribute) and one or more certificate validation records. App Runner then performs DNS validation to verify that you own or control the domain name you associated. App Runner tracks domain validity in a certificate stored in AWS Certificate Manager (ACM).

CloudFormation Example

CloudFormation code does not have the related resource.

Frequently asked questions

What is AWS App Runner Custom Domain Association?

AWS App Runner Custom Domain Association is a resource for App Runner of Amazon Web Service. Settings can be wrote in Terraform.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.