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).
Parameters:
-
service_arn
(AppRunnerResourceArn)
–
The Amazon Resource Name (ARN) of the App Runner service that you want to associate a custom domain name with.
-
domain_name
(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).
-
enable_www_subdomain
(Optional[NullableBoolean], default:
None
)
–
Set to true to associate the subdomain www.DomainName with the App Runner service in addition to the base domain.
Default: true
Raises:
Source code in docs_src/capo_apprunner/_services/app_runner.py
| def associate_custom_domain(
self,
service_arn: "capo_apprunner.types.app_runner_resource_arn.AppRunnerResourceArn",
domain_name: "capo_apprunner.types.domain_name.DomainName",
*,
config_overrides: Optional[AppRunnerClientConfig] = None,
enable_www_subdomain: Optional[
"capo_apprunner.types.nullable_boolean.NullableBoolean"
] = None,
) -> "capo_apprunner.types.associate_custom_domain_response.AssociateCustomDomainResponse":
"""<p>Associate your own domain name with the App Runner subdomain URL of your App Runner service.</p> <p>After you call <code>AssociateCustomDomain</code> and receive a successful response, use the information in the <a>CustomDomain</a> 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 <a href="https://docs.aws.amazon.com/acm/latest/userguide">AWS Certificate Manager (ACM)</a>.</p>
Args:
service_arn: <p>The Amazon Resource Name (ARN) of the App Runner service that you want to associate a custom domain name with.</p>
domain_name: <p>A custom domain endpoint to associate. Specify a root domain (for example, <code>example.com</code>), a subdomain (for example, <code>login.example.com</code> or <code>admin.login.example.com</code>), or a wildcard (for example, <code>*.example.com</code>).</p>
enable_www_subdomain: <p>Set to <code>true</code> to associate the subdomain <code>www.<i>DomainName</i> </code> with the App Runner service in addition to the base domain.</p> <p>Default: <code>true</code> </p>
Raises:
capo_apprunner.errors.internal_service_error_exception.InternalServiceErrorException: <p>An unexpected service exception occurred.</p>
capo_apprunner.errors.invalid_request_exception.InvalidRequestException: <p>One or more input parameters aren't valid. Refer to the API action's document page, correct the input parameters, and try the action again.</p>
capo_apprunner.errors.invalid_state_exception.InvalidStateException: <p>You can't perform this action when the resource is in its current state.</p>
capo_apprunner.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_apprunner.types.associate_custom_domain_request.AssociateCustomDomainRequest]",
) -> OperationResponse[
"capo_apprunner.types.associate_custom_domain_response.AssociateCustomDomainResponse"
]:
import capo_apprunner._operations.app_runner.associate_custom_domain
output, http_response = (
capo_apprunner._operations.app_runner.associate_custom_domain.associate_custom_domain(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AssociateCustomDomain")
)
input_: capo_apprunner.types.associate_custom_domain_request.AssociateCustomDomainRequest = {
"service_arn": service_arn,
"domain_name": domain_name,
}
if enable_www_subdomain is not None:
input_["enable_www_subdomain"] = enable_www_subdomain
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|