amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

Wildcard subdomains in AWS Amplify

Open cjimenezber opened this issue 6 years ago • 107 comments

So we recently decided to remove server side rendering from our react app to use Amplify, since it provides us all that we need (serverless, high availabilty, speed and no need to test in two environments).

However now I have a question regarding how to configure AWS Amplify to have a wildcard CNAME record. I want that any subdomain can reach my app, not just the ones I manually select in the Amplify Console.

I have a wildcard CNAME in Route 53 pointing to the cloudfront, and the subdomains I added manually in the console are working, but the ones that are not (due to the nature of the wildcard CNAME), just get a 403 from cloudfront.

Is there support for wildcard subdomains in Amplify?

How does one configure it? Assuming there is no support for this.

Is there an API I can use to create the Amplify subdomains for me rather than doing it manually everytime a client purchases access?

cjimenezber avatar Aug 09 '19 21:08 cjimenezber

@cjimenezber you should be able to create domain associations via the AWS CLI: https://docs.aws.amazon.com/cli/latest/reference/amplify/create-domain-association.html

We have a feature request for domain patterns in our backlog. Thanks hope this helps.

swaminator avatar Aug 09 '19 23:08 swaminator

I have another question, to finalize this. We will be either adding them manually or using a cron job that invokes a CLI method with the new customers. When doing manual changes to the subdomains I noticed that all subdomains slow down greatly while the domain gets reverified and everything gets added to cloudfront.

Will this happen for all domains/sub-domains every time I update the list of subdomains?

cjimenezber avatar Aug 12 '19 14:08 cjimenezber

First of all, we have a limit on total number of subdomains you can add to each customer domain (50). Secondly, any update to the subdomains(including add and remove) it will require us to update the cloudfront behind, which takes about 10-15mins.

VividKnife avatar Aug 12 '19 18:08 VividKnife

Alright, will there be any notification of when the wildcard subdomain feature is finished?

cjimenezber avatar Aug 19 '19 15:08 cjimenezber

Any update on wildcard subdomains?

favour121 avatar Jan 04 '20 23:01 favour121

Any updates? I am in need of this feature.

MR-Neto avatar May 05 '20 16:05 MR-Neto

+1 to this feature request, or the next best solution for wildcard subdomains

leewenjie avatar May 24 '20 05:05 leewenjie

The feature is most definitely required

cyborganic avatar May 25 '20 07:05 cyborganic

+1

eduardotamaki avatar Jun 14 '20 17:06 eduardotamaki

+1

divsbhalala avatar Jun 19 '20 11:06 divsbhalala

+1

dtelaroli avatar Jun 22 '20 00:06 dtelaroli

+1

danielfolley avatar Jun 22 '20 20:06 danielfolley

+1

Kaustubh26 avatar Jul 04 '20 07:07 Kaustubh26

+1

YorbenVerhoest avatar Jul 07 '20 08:07 YorbenVerhoest

+1 Please update on this, We are getting delay in our production launch. Please answer yes/No

anuj-bluebash avatar Jul 14 '20 18:07 anuj-bluebash

I have created this js function as workaround. It's not a wildcard, but at least I can create on demand subdomains, programmatically:

https://gist.github.com/dtelaroli/ffbebd858f5089bfb7532ff3d96fb7ea

dtelaroli avatar Jul 14 '20 18:07 dtelaroli

@anuj-bluebash, We currently don't support wildcards as a subdomain prefix. We have a feature request in our backlog to address this, and will let you know once it's rolled out. Thanks for your patience.

abhi7cr avatar Jul 14 '20 18:07 abhi7cr

Would anyone be aware whether this would be possible to achieve through the Cloudfront and S3 hosting option? I see that the docs support it, but not aware of the limitations or if there are any issues with using this solution.

https://aws.amazon.com/about-aws/whats-new/2013/09/18/amazon-cloudfront-announces-wildcard-cname-support/#:~:text=We're%20excited%20to%20let,distribution%20to%20include%20each%20subdomain.

Kaustubh26 avatar Jul 15 '20 04:07 Kaustubh26

@swaminator @abhi7cr is there any workaround for wildcards to work? I don't see CloudFront for application deployed using Amplify in my AWS Console, so I assume it's internal. Maybe there is way for me to create own CloudFront and setup DNS manually? It would be wonderful if I could keep CI pipeline and setup CloudFront on my own.

skolodyazhnyy avatar Aug 01 '20 10:08 skolodyazhnyy

Would anyone be aware whether this would be possible to achieve through the Cloudfront and S3 hosting option? I see that the docs support it, but not aware of the limitations or if there are any issues with using this solution.

https://aws.amazon.com/about-aws/whats-new/2013/09/18/amazon-cloudfront-announces-wildcard-cname-support/#:~:text=We're%20excited%20to%20let,distribution%20to%20include%20each%20subdomain.

I ended up going for this option, we have a production app using S3 + Cloudfront with Wildcard CNAME record.

cjimenezber avatar Aug 02 '20 02:08 cjimenezber

+1

cdac901 avatar Aug 11 '20 22:08 cdac901

First of all, we have a limit on total number of subdomains you can add to each customer domain (50). Secondly, any update to the subdomains(including add and remove) it will require us to update the cloudfront behind, which takes about 10-15mins.

Can the limit be increased? We are using it so that each account have their own subdomain.

niknokseyer avatar Sep 09 '20 01:09 niknokseyer

I have tried and after two weeks I received no as answer

dtelaroli avatar Sep 09 '20 01:09 dtelaroli

This issue was closed so we missed this. Reopened it to let you know that we launched a feature for automatic subdomains that match a pattern. Please let us know if this will work for you: https://aws.amazon.com/blogs/mobile/automatically-create-and-delete-custom-sub-domains-for-your-branch-deployments-with-amplify-console/

swaminator avatar Sep 15 '20 06:09 swaminator

This issue was closed so we missed this. Reopened it to let you know that we launched a feature for automatic subdomains that match a pattern. Please let us know if this will work for you: https://aws.amazon.com/blogs/mobile/automatically-create-and-delete-custom-sub-domains-for-your-branch-deployments-with-amplify-console/

Can the subdomain limit be increased? We are using it so that each account have their own subdomain.

niknokseyer avatar Sep 15 '20 06:09 niknokseyer

The short answer is NO

dtelaroli avatar Sep 15 '20 14:09 dtelaroli

The short answer is NO

What’s gonna be the workaround for that? Are wildcards possible?

niknokseyer avatar Sep 15 '20 15:09 niknokseyer

No, you can use wildcards configuring it directly at route53, cloudfront and acm, but amplify does not support yet. We are waiting for aws team to solve this issue. I also need this feature, but following the time that AWS takes to solve some issues (near to 3 years), I will move my project from amplify to an own configuration at cloudfront ou cloudflare when I would have 50 customers.

dtelaroli avatar Sep 15 '20 15:09 dtelaroli

The short answer is NO

@dtelaroli that isn't really going to help us prioritize the issue. Can I understand a bit more in detail why the subdomain autodetection will not work for you? Again, apologies that this issue slipped under the rug as it was closed. But given I reopened it, I'd like to understand the usecase a bit more.

swaminator avatar Sep 15 '20 16:09 swaminator

@niknokseyer not currently but we will enable limit increases soon.

swaminator avatar Sep 15 '20 18:09 swaminator