AWS App Runner now supports Amazon Route 53 alias records for creating a root domain name.
When you create an App Runner service, by default, App Runner allocates a domain name to your service. If you have your own domain name, you can associate it to your App Runner service as a custom domain name. Now, you can use Amazon Route 53 alias record to create a root domain or subdomain for your App Runner service.
Managing custom domain names for an App Runner service
When you create an AWS App Runner service, App Runner allocates a domain name for it. This is a subdomain in the awsapprunner.com domain that's owned by App Runner. You can use the domain name to access the web application that's running in your service.
If you own a domain name, you can associate it to your App Runner service. After App Runner validates your new domain, you can use your domain to access your application in addition to the App Runner domain. You can associate up to five custom domains.
Associate (link) a custom domain to your service
When you associate a custom domain to your service, you must add the CNAME records and DNS target records to your DNS server. The following sections provide information on CNAME records and DNS target records and how to use them.
CNAME records
When you associate a custom domain with your service, App Runner provides you with a set of CNAME records serve for certificate validation purpose. You must add these CNAME records to your Domain Name System (DNS) server. Add the certificate validation records, provided by App Runner, to your DNS server. This way, App Runner can validate that you own or control the domain.
App Runner uses ACM to verify the domain. If you're using CAA records in your DNS records, make sure that at least one CAA record references amazon.com. Otherwise, ACM can't verify the domain and successfully create your domain.
If you receive errors related to CAA, see the following links to learn how to resolve them:
Certification Authority Authorization (CAA) problems
How do I resolve CAA errors for issuing or renewing an ACM certificate?
Troubleshooting custom domain names for an App Runner service
DNS target records
Add the DNS target records to your DNS server to target the App Runner domain. Add one record for the custom domain, and another for the www subdomain, if you chose this option. Then, wait for the custom domain status to become Active in the App Runner console. This typically takes several minutes, but might take up to 24—48 hours (1—2 days). When your custom domain is validated, App Runner starts routing traffic from this domain to your web application.
Specify a domain to associate with your App Runner service
You can specify a domain to associate with your App Runner service in the following ways:
- A root domain – DNS has some inherent limitations which might block you from creating CNAME records for the root domain name. For example, if your domain name is
example.com
, you can create a CNAME record that routes traffic foracme.example.com
to your App Runner service. However, you can't create a CNAME record that routes traffic forexample.com
to your App Runner service. To create a root domain, ensure that you add an alias record.
An alias record is specific to Route 53 and has the following advantages over CNAME records:
Route 53 provides you with more flexibility as alias records can be created for root domain or subdomain. For example, if your domain name is
example.com
, you can create a record that routes requests forexample.com
oracme.example.com
to your App Runner service.It is more cost efficient. This is because Route 53 doesn't charge for requests that use an alias record to route traffic.
A subdomain – For example,
login.example.com
oradmin.login.example.com
. You can optionally also associate the www subdomain as part of the same operation. You can add either CNAME or alias record for subdomain.A wildcard – For example,
*.example.com
. You can't use the www option in this case. You can specify a wildcard only as the immediate subdomain of a root domain and only on its own. These aren't valid specifications:login*.example.com
,*.login.example.com
. This wildcard specification associates all immediate subdomains, and doesn't associate the root domain itself. The root domain must be associated in a separate operation.
A more specific domain association overrides a less specific one. For example, login.example.com
overrides *.example.com
. The certificate and CNAME of the more specific association are used.
The following example shows how you can use multiple custom domain associations:
Associate
example.com
with the home page of your service. Enable the www to associatewww.example.com
.Associate
login.example.com
with the login page of your service.Associate
*.example.com
with a custom "not found" page.
Disassociate (unlink) a custom domain
You can disassociate (unlink) a custom domain from your App Runner service. When you unlink a domain, App Runner stops routing traffic from this domain to your web application.
Manage custom domains
Manage custom domains for your App Runner service using one of the following methods:
To associate (link) a custom domain using the App Runner console
Open the App Runner console, and in the Regions list, select your AWS Region.
In the navigation pane, choose Services, and then choose your App Runner service.
The console displays the service dashboard with a Service overview.On the service dashboard page, choose the Custom domains tab.
The console shows the custom domains that are associated with your service, or No custom domains.
On the Custom domains tab, choose Link domain.
In the Link custom domain dialog, enter a domain name, and then choose Link custom domain.
Copy the certificate validation records and DNS target records, and add them to your DNS server. App Runner can then validate that you own or control the domain.
For more information about Configure certificate validation, see DNS Validation in the AWS Certificate Manager User Guide.
For information about how to Configure DNS target with Amazon Route 53 alias record, see Configure Amazon Route 53 alias record for your target DNS.
- Choose Close
The console shows the dashboard again. The Custom domains tab has a new tile showing the domain that you just linked in the Pending certificate DNS validation status.
- When the domain status changes to Active, verify that the domain works for routing traffic by browsing to it.
To disassociate (unlink) a custom domain using the App Runner console
On the Custom domains tab, select the tile for the domain you want to disassociate, and then choose Unlink domain.
In the Unlink domain dialog, verify the action by choosing Unlink domain.
Top comments (0)