Closed StErMi closed 4 years ago
@StErMi yeah, unfortunately, custom domains are only supported in us-east-1 atm. This is due to an AWS limitation.
To be more specific, the express component uses AWS APIGV2 HTTP under the hood, which only supports regional endpoints that requires the cert to be in the same region as the API, and because ACM free certs are only available in us-east-1, your API must also be in us-east-1.
Hi @eahefnawy as far as I can see from the ACM
Public SSL/TLS certificates provisioned through AWS Certificate Manager are free. You pay only for the AWS resources you create to run your application.
am I interpreting it wrongly?
@eahefnawy what do you mean with "custom domains"? This domain has been registered with Route53. And as far as I can see in your README file both express
and website
are supporting custom domains.
At the moment you are forcing the us-east-1
region in both express
and website
components. I would like to understand why and which could be some solutions.
Otherwise, it seems that the only thing I can do is to deploy all my lambda functions only in the us-east-1
region...
@StErMi we are not forcing us-east-1
. This is a limitation from AWS. I'll try to break it down for you:
us-east-1
, another AWS limitation, which would not satisfy the condition in the point above unless your APIG is also in us-east-1
, hence the error above.Do you see the dilemma? So until AWS APIG V2 HTTP supports EDGE
endpoints, this seems to be an issue.
The website component, on the other hand, shouldn't have this issue. Are you facing this issue with the website component as well?
I hope this clears things up. This is all based on my humble understanding of AWS, but please do correct me if I'm wrong.
Hi @eahefnawy sorry for the delay.
The website component (I think for the same reason) has us-east-1 enforced into code as well
I don't get why you say that the AWS Certificate must be requested on us-east-1
So as far as I understood working with the framework and AWS the only limitation from AWS is that you need to create a CERT from us-east-1
to be used for your CF distribution.
Everything else can be regional without a problem. The only other limitation (but I need to experiment) that comes to my mind would be for the API custom domain distributed through CF. So maybe I would be limited to us-east-1
even for that. So everything should be under us-east-1
region.
If that's the case, I don't get how would it be possible to have a distributed system around the globe or even just in Europe (if all my customers are from Europe).
So as far as I understood working with the framework and AWS the only limitation from AWS is that you need to create a CERT from us-east-1 to be used for your CF distribution.
Yep, that is correct. Just the CERT needs to be in us-east-1. Everything else could be in other regions. The issue as explained above is the fact that APIG V2 HTTP does not yet support EDGE endpoints, which allows the use of CERTS from any region.
If that's the case, I don't get how would it be possible to have a distributed system around the globe or even just in Europe (if all my customers are from Europe).
Yeah unfortunately until AWS APIGV2 HTTP supports EDGE endpoints, that will be a limitation.
Also, I double-checked with the website component, and the region is only hardcoded for ACM, which is the desired behavior. So you should be able to deploy websites with custom domains to any region because AWS APIGV2 HTTP and its limitation is not involved here.
REF: https://github.com/serverless-components/website/search?q=us-east-1&unscoped_q=us-east-1
If you'd like to explore more, I suggest you remove the domain
property from your express
YAML file and deploy it to any region you want. This should work, but you will not have a custom domain.
You can then configure the domain manually if possible. Based on my own trials, I personally don't think it's currently possible with the free CERT, but I could be wrong. If you are able to pull it off, we'd be happy to incorporate your changes 😊
I just stumbled upon this page and thought I'd share it here. https://aws.amazon.com/premiumsupport/knowledge-center/custom-domain-name-amazon-api-gateway/
Only REST APIs can use edge-optimized custom domain names.
From this page, it is clear that only API Gateway V1 (ie. REST APIs) supports EDGE domains.
Hello! I'm having a similar problem and I came across this: https://aws.amazon.com/premiumsupport/knowledge-center/acm-export-certificate/. It's saying I could create the same certificate in a different region and use it for resources in that region.
If I read the utils code here and according to the ACM API, we always return the first certificate with the same domain name so it could be in the wrong region.
I think if we could somehow check the provided region and use that when checking the domain, we might be able to get it to use the right certificate.
I'm still new to AWS/serverless framework so please correct me if I'm wrong. :)
References:
Thanks for the thorough research @eddeee888 ... You could be correct, which I guess would fix this issue, but I think we still won't be able to use EDGE endpoints until APIG2 officially support it.
I'll investigate this more...
This is my serverless.yaml
and this is the error output