Closed a2ush closed 2 years ago
Please address this issue, its insane to sell the Apprunner service on your platform and not be able to target it via root domain. How was this even allowed to be pushed to the customer without this feature, it's 2022 now.
The App Runner documentation implies this feature already exists. It says:
You can specify a domain to associate with your App Runner service in the following ways:
- A root domain – For example, example.com. You can optionally associate www.example.com too as part of the same operation.
It also states:
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 also associate www.example.com.
If it's possible to associate a root domain with App Runner as mentioned above, an example would likely resolve this issue for most people.
Some Customer Obsession here please.
To get my domain working with App Runner and Route 53, I did this:
Link www.my-domain.com
as a custom domain in the App Runner console.
Create an S3 bucket my-domain.com
with static hosting enabled. Set it to redirect requests to www.my-domain.com
over https.
Create an A record at the apex domain pointing to the S3 my-domain.com
bucket.
Now hitting my-domain.com/anything-at-all
redirects to https://www.my-domain.com/anything-at-all
.
Thank you for bringing this up. Looking into it.
@tforbus Just a heads up, S3 can't terminate tls, so in your current configuration, http://example.com
would redirect, but https://example.com
would have a cert issue. You need to point your DNS to a CloudFront distribution that serves from your S3 bucket. You'll also need to configure your distribution to terminate tls using a cert created in ACM.
Which is to say, there's quite a bit of infra required for something the docs suggest should work out of the box.
@tforbus Just a heads up, S3 can't terminate tls, so in your current configuration,
http://example.com
would redirect, buthttps://example.com
would have a cert issue. You need to point your DNS to a CloudFront distribution that serves from your S3 bucket. You'll also need to configure your distribution to terminate tls using a cert created in ACM.Which is to say, there's quite a bit of infra required for something the docs suggest should work out of the box.
Thanks, I had noticed the redirect issues. Had looked at doing CloudFront like you suggested but was having issues with it pointing to the bucket. I'd assumed from the redirect rules, but maybe the cert like you're talking about.
Hi. It seems like this is still the issue. Would it be possible to at least modify the docs to clearly state this is not possible to do? The docs are misleading now.
Cloudfront is not ideal, and adds ~300ms of latency that doesn't happen when hitting the root apprunner URL.
And yes, this is still an issue
Hi, working on the docs to remove the misleading information.
@marekaf the document has been updated with a Note to clarify that this is not supported at the moment with Route 53. Thank you for your inputs.
App Runner now supports Amazon Route 53 alias record for App Runner service domain name. Thank you all for the feedback. https://docs.aws.amazon.com/apprunner/latest/relnotes/release-2022-08-30-route53.html
Hi,
I was able to create an alias using the AWS console, thank you!
I am trying to create an alias record using AWS API. How can I get AliasTarget.HostedZoneId for App Runner?
Hi, here is the link to Apprunner hosted zone id: https://docs.aws.amazon.com/general/latest/gr/apprunner.html
If I understand this correctly you cannot have an APEX record in regions that AppRunner does not have a HostedZoneId? this should be better documented! I cannot even make this record on the Route53 UI for Frankfurt region.
I'm using Terraform generally, but same thing in the end.
I create a redirection by a CNAME record to the App Runners exposed .service_url
:
resource "aws_route53_record" "cname_app_runner" {
zone_id = aws_route53_zone.main.zone_id
name = "www.subdomain-1.subdomainovich.my-domain.net"
type = "CNAME"
ttl = "300"
records = [---apprunner_service_url---]
}
in context:
resource "aws_route53_zone" "main" {
name = "my-domain.net"
}
# NS Records to delegate DNS resolution to AWS Route 53 name servers
resource "aws_route53_record" "ns_records" {
zone_id = aws_route53_zone.main.zone_id
name = aws_route53_zone.main.name
allow_overwrite = true
type = "NS"
ttl = 300
records = ["ns-smth.smth-smth.smth", "ns-smth.smth-smth.smth", "ns-smth.smth-smth.smth", "ns-smth.smth-smth.smth.smth"]
}
# CNAME Record for App Runner
resource "aws_route53_record" "cname_app_runner" {
zone_id = aws_route53_zone.main.zone_id
name = "www.subdomain-1.subdomainovich.my-domain.net"
type = "CNAME"
ttl = "300"
records = [---apprunner_service_url---]
}
# Alias for Cloudfront
resource "aws_route53_record" "a_cloudfront" {
zone_id = aws_route53_zone.main.zone_id
name = "www.subdomain.subdomainovich.my-domain.net"
type = "A"
# create alias (required: name, zone_id)
alias {
name = aws_cloudfront_distribution.main.domain_name
zone_id = aws_cloudfront_distribution.main.hosted_zone_id
evaluate_target_health = true
}
}
Community Note
Tell us about your request
Request to register App Runner service default domain as an alias record, as well as Elastic Beanstalk.
Currently, we have to register the service domain as CNAME record. So we cannot associate it with a zone apex in Route 53.
Additional context
Choosing between alias and non-alias records https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html