associateCustomDomain method
Associate your own domain name with the App Runner subdomain URL of your App Runner service.
After you call AssociateCustomDomain and receive a successful
response, use the information in the CustomDomain record that's
returned to add CNAME records to your Domain Name System (DNS). For each
mapped domain name, add a mapping to the target App Runner subdomain and
one or more certificate validation records. App Runner then performs DNS
validation to verify that you own or control the domain name that you
associated. App Runner tracks domain validity in a certificate stored in
AWS Certificate
Manager (ACM).
May throw InternalServiceErrorException.
May throw InvalidRequestException.
May throw InvalidStateException.
Parameter domainName :
A custom domain endpoint to associate. Specify a root domain (for example,
example.com), a subdomain (for example,
login.example.com or admin.login.example.com),
or a wildcard (for example, *.example.com).
Parameter serviceArn :
The Amazon Resource Name (ARN) of the App Runner service that you want to
associate a custom domain name with.
Parameter enableWWWSubdomain :
Set to true to associate the subdomain
www.DomainName with the App Runner service in
addition to the base domain.
Default: true
Implementation
Future<AssociateCustomDomainResponse> associateCustomDomain({
required String domainName,
required String serviceArn,
bool? enableWWWSubdomain,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AppRunner.AssociateCustomDomain'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DomainName': domainName,
'ServiceArn': serviceArn,
if (enableWWWSubdomain != null)
'EnableWWWSubdomain': enableWWWSubdomain,
},
);
return AssociateCustomDomainResponse.fromJson(jsonResponse.body);
}