sladg / nextjs-lambda

Lambda deployments for Nextjs12 & Nextjs13 (standalone). Easy CLI commands to get your standalone Next output to run in AWS Lambda (not @Edge)! Uses CDK in behind and produces code zips importable to Terraform, Serverless, Azure, etc.
MIT License
169 stars 19 forks source link

[FR] Allow to bypass Route53 DNS record. #80

Closed pinarruiz closed 1 year ago

pinarruiz commented 1 year ago

Related to #79.

Add a flag that will disable automatic Route53 record creation, so it is possible to use other DNS servers, or fallback to just adding the custom domain name to Cloudfront.

sladg commented 1 year ago

You may choose to not pass any domains. In such case, it will result in CloudFront's domain to be used. Afterwards, you can manually create whatever DNS records you need that will target Cloudfront.

sladg commented 1 year ago

Considering Cloudfront is target alias, I really don't think you can simply plug-n-play different DNS server. You will need to create hosted zone on AWS and setup NS for it.

Aka.

This results in you always having hosted zone on AWS as you cannot point other DNS server to Cloudfront's IP (as Cloudfront does not have IP).

I hope I understood the request correctly, let me know.

pinarruiz commented 1 year ago

The use case would be, for example having example.com on Cloudflare for example, and lets say that I want to deploy the nextjs site to app.example.com, not to example.com, i could set up a custom domain name on Cloudfront and also set a cname record at Cloudflare that is pointed at the cloudfront dristribution url (for example d111111abcdef8.cloudfront.net), so I would not need R53 records.

The whole thing would llok something like this:

sladg commented 1 year ago

This does not seem like very reasonable pattern to be honest. I wouldn't recommend using CNAME for Cloudfront, seems like you are just going around setting up DNS properly.

I cannot support this out of box as manual steps are required (setting DNS records on Cloudflare to validate certificate). Considering the focus on AWS and your scenario not being 100% automated, I'm gonna close this.

Feel free to create stack without domain names and manually add them after creation via AWS Console.