aws / apprunner-roadmap

This is the public roadmap for AWS App Runner.
https://aws.amazon.com/apprunner/
Other
301 stars 14 forks source link

Enable to register App Runner service domain as an alias record in Route 53. #53

Closed a2ush closed 2 years ago

a2ush commented 3 years ago

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

rsikandar commented 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.

kevlened commented 2 years ago

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:

  1. 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.

khalidjaz commented 2 years ago

Some Customer Obsession here please.

tforbus commented 2 years ago

To get my domain working with App Runner and Route 53, I did this:

  1. Link www.my-domain.com as a custom domain in the App Runner console.

  2. Create an S3 bucket my-domain.com with static hosting enabled. Set it to redirect requests to www.my-domain.com over https.

  3. 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.

keerataws commented 2 years ago

Thank you for bringing this up. Looking into it.

kevlened commented 2 years ago

@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 commented 2 years ago

@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.

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.

marekaf commented 2 years ago

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.

Negan1911 commented 2 years ago

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

keerataws commented 2 years ago

Hi, working on the docs to remove the misleading information.

keerataws commented 2 years ago

@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.

snnles commented 2 years ago

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

mraszplewicz commented 2 years ago

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?

scuw19 commented 2 years ago

Hi, here is the link to Apprunner hosted zone id: https://docs.aws.amazon.com/general/latest/gr/apprunner.html

kkarimi commented 1 year ago
Screenshot 2023-05-25 at 17 13 38

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.

ernestyouniverse commented 8 months ago

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
  }
}