How to set up a public zone in GCP - google-cloud-platform

I just moved a simple, static website to GCP, and it's working fine. But I want to keep using a separate company as registrar, not the hosting company. So as a shortcut, I just set the www CNAME at the registrar's site to c.storage.googleapis.com, without using Google's DNS - and this works.
But is it good practice? If not, could someone recommend a step-by-step guide to setting up a public zone on GCP? Google's documentation is complicated, getting into private zones, authentication, and service accounts, which I probably don't need.

As long as the company providing your DNS services is reliable and has the DNS features you require, it really does not matter which DNS provider you use.
You bring up the point of good practice. There are lots of opinions, some prefer that the same cloud provider host DNS, others recommend separating these functions.
There are situations where you want the DNS servers in the same cloud. For example AWS supports A-ALIAS records which are a logical fit for AWS load balancers. Take a look at your current DNS server requirements and look forward to what you may need next year, etc. Then pick a DNS provider that meets your requirements.
It is also very easy today to switch both registrars and DNS providers. It can be a pain for a couple of days while DNS switches over, but this just means hosting your records with two companies while the world synchronizes.

Related

Allowing custom domain names for tenants on multi tenant SaaS platform hosted on AWS

Overview
I am building a multi tenant SaaS platform on AWS. The deployment architecture for now is very simple.
I have a ELB (all traffic falls here)
I have few EC2 instances (hosting my java + angular application). This is under a Autoscaling group which is linked to the ELB.
I have a MySQL cluster in RDS which the EC2 talks to.
Everything is in a VPC and the EC2 and RDS are in private subnets,
Problem
I would prefer my clients (tenants) to have their own domain name. For e.g. Let's say that right now my application is accessible at the URL http://xyz-elb.amazon.aws.com
I would like to enable my clients to access the application using
http://tenant1.com
http://tenant2.com
and so one. I know this is possible because I have seen this in different multi tenant SaaS applications.
Research I have done till now:
I read about reverse proxy which can accomplish it however, I didn't get any reliable link. Tried reading about HAProxy but I feel that I am going in the wrong direction.
What I need
Expert opinion on different ways to do domain mapping
List & Link of resources which address this particular problem
Any practical experience or case studies by any of you cool guys here
A cheap solution (I don't want to go via Amazon API Gateway / Route53 Policies which doesn't seem to fit my need)
Thank you so much for reading my question. And thanks in advance for your efforts to reply on this.
Just create a DNS CNAME resource record in each tenant domain, pointing to your apps ELB DNS name.
I prefer to alias the ELB DNS name to my service domain, then alias the tenant domain to it. Example:
app.example.com IN CNAME my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com
Then in my tenant DNS:
app.tenant1.com IN CNAME app.example.com.
This aliasing allows you to change your ELB endpoint if required, without having to change the DNS records for all clients.

Issues using Google Domains and AWS

So, this is my first time setting up a simple website and I decided to purchase a domain on Google Domains and I plan on hosting it on the AWS Free Tier plan. The domain was purchased last week. So, I am cannot transfer because the domain name is within 60 days of initial registration.
The goal is to create a simple landing page which uses a PHP script to generate a simple mailing list.
I have read this link 2-3 times already and followed all the steps:
https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
I want to keep all my G Suite features but I cannot because the guide asks me to copy AWS nameservers in my hosted zone to the DNS settings on Google Domains. This results in this.
I want to stick to AWS and not move to another hosting service, for certain reasons. Please guide me in the right direction. Thank you.
So I was able to fix this after I studied a bit and posted it on Reddit and got the answer.
Because we are working with subdomains, I made an S3 bucket with the subdomain name. I made the files public and generated the standard policy. Took the S3 bucket endpoint, and then went back to Google Domain's DNS settings.
I didn't need Route 53 in the first place. All I did was create a CNAME record with the subdomain and set TTL to 1 minute and the S3 endpoint as the data. And BOOM! It worked.
I believe when I move on to create more dynamic websites, I have to expand my search and learn more.
Thank you for everyone's help.
You can keep using Google Nameservers, along with hosting your website on you AWS Server (whatever the service you are using, like EC2, beanstalk).
Suppose if you are using an EC2 instance to host your server, make a note of its Public IP (I'd recommend using elastic IP). Now go to your google domain record set and create an A record with the IP of your EC2 instance.
refer https://support.google.com/a/answer/2579934?hl=en for details.
Using route53 is optional. It just helps you to store resource records. If you can create them somewhere else, Route53 is not required.

how do heavy traffic websites handle load using dns routing?

It says larger websites have their server distributed on several machines running the same website and depending on load a user is routed to one of the server machines . This happens without users knowledge and under same domain name as far as user's interface is concerned.
now the bit I don't get is even though you eliminate the bottleneck of using a single server by using distributed server how would you eliminate the bottleneck of dns.
It would require some kind of routing gateway that routes user to one of the servers for the Web page (resolving dns) now this gateway would be bombarded with requests.
So how would you reduce the routing gateway load?
Usually, you'll use several DNS servers for the zone. Even when you do that though, there are techniques to do this load balancing at the network layer.
Commonly referred to as "anycast", it's possible for multiple hosts to have the same IP address on the internet. Normal internet routing can then be used to route users to a server on the best path.
For example, you could put DNS servers on all continents and assign them all the same address, 8.8.8.8. Users in Europe would most likely end up on the European DNS server.
There is quite a bit of investment and administrative overhead for this, which is one of the reasons why globally distributed DNS hosting providers charge a premium price for this feature.

AWS Multiple domains pointing to same server

I'm building a solution that will be provided to several companies. Any company will have to point their domains (or just a sub-domain) to my server and then I'll handle pages to their customers.
I'm testing it with the following config:
CustomerABC.com pointing to one hosted zone into Route 53
CustomerDEF.com pointing to another hosted zone into Route 53
Both hosted zones have an A record pointing to the same EC2 server instance
That said, every customer that wants to use my service will have to change its domain's DNS to his own hosted zone in my Route53. My server will handle many domains.
I'd like not having to create a new hosted zone for every new customer. Is there any way to achieve the same result?
Put Elactic Load Balancer in front of your application instance (even if you will use only one instance at the beginning).
Using your domain (the zone does not have to be hosted on Route53), create one CNAME (or ALIAS) record (for example myapp.example.com) and point it to your load balancer's domain name.
Simply tell your customers to CNAME their subdomain to your app dns name
If a business I was looking to do business with told me I needed to create a new zone on my DNS to access an application, I would very quickly move my business elsewhere! Especially if they wanted control of that zone, there are big security issues in allowing that. You will almost certainly lose business if you make that a requirement.
This is a commonly solved problem for thousands of businesses across the internet, you simply tell them to point their domain to your servers and you figure out which customer is which. Either by using something like the HTTP Servername field, or having some manner of authentication process that differentiates them from the other users.
By far the simplest method is having a CNAME record that you point all of your customers to. Depending on your business model it can be useful to give each customer a custom CNAME, some random unique ID, so if you need to expand and move clients in future you can do them a number at a time.
Look around at your competitors, or just generally around other businesses that have similar web models. Understand how they engineer their infrastructure and emulate that. But taking a whole DNS zone, is a really bad idea.

DNS solution when porting LAMP service from shared hosting to AWS EC2

I have create a LAMP based service on a shared hosting provider. It has now grown and I want to move it on AWS EC2. I have already ported the code and the data, set up ESB for the persistent content, set up an AMI image that boots up fine and has tested the solution on EC2.
I want now to redirect my DNS to the EC2 instance(s) IP. I have asked my shared hosting provider if they can redirect the TLD record (domain.com) to this IP, but they say they can only redirect safely a subdomain (like www.domain.com) because the cPanel breaks if the TLD is redirected. I'm not sure I follow the problem details, but it looks like I have to rent a DNS solution.
What alternatives do I have? I think DynDNS.com is one solution (or a similar service), what else? Or, amongst commercial DNS services, what are good choices in terms of reliability, quality of service, quality of support etc?
Seems on you have one foot on the ship and on one the shore! But the good news is you're almost there!
I suggest leaving your shared host. If they are unable to support you with such a request, it's a good sign you've outgrown the service. There are a few options for you to consider.
First of all, when moving web hosting from shared to AWS, you also need to consider what to do with the DNS, email and cPanel services. I use AWS for web hosting, but separate providers for DNS and email. I don't use cPanel - I just configure DNS and the web server manually. This keeps things much simpler and much more flexible, and the only extra cost is a bit of time to configure DNS separately. cPanel, Plesk and similar systems add a lot of unnecessary complexity into Apache and I find this causes problems later.
Though, if you want to keep cPanel, you might consider installing it or some other web-based management system on AWS. (I'd bet you'd find a prebuilt AMI for this if you look around.)
I'm not sure about running a DNS server on AWS, but I think it would be much easier and more reliable to use a DNS service.
EasyDNS.com and No-IP.com are both great DNS hosts - I've used No-IP for my enterprise AWS web hosting for over 2 years. (It is particularly good because they offer monitoring, and automatic and manual DNS failover in case there's a problem. But, that may be more than you need.) I've used EasyDNS for 4 or 5 years. Both services have solid support and are very reliable.
If you want something free, MyDomain.com has been very reliable for me for almost 10 years, but support is very slow. MyDomain will host your DNS for free even if you didn't register the domain with them.
One last consideration in addition to these: Amazon also offers Elastic IPs, which is basically a static IP for your web server instance. Using this will make your DNS much simpler, give you flexibility to easily change to a new instance in the future, if you ever need to. I strongly recommend using an Elastic IP.
I've used EasyDNS, their DNS rates are reasonable and always been fast to help.
https://dns.he.net/ - free for up to 50 domains. Supports IPv6 AAAA records, custom TTL and has convenient management interface.
The life cycle of a web request has many pieces. I will try to explain the individual pieces so you can fill in the blank according to how you best see fit.
Domain registration (could be your current host, or someone else)
Where does this domain point to ? i.e which server answers requests forwarded to this domain? (this is determined by DNS records i.e in your case A record should point to the server). You most likely need to modify this.
Previously, you were using your host, so most likely in DNS the A entry pointed to their server. Like SaintSal mentioned easiest way is to change it to the elastic IP you get from AWS. I don't know why your host does not allow modification of TLD, but it shouldn't break cpanel. [perhaps if you have been with them for more than 90days, you can transfer your registration to another provider - I personally use dreamhost. With dreamhost, such a setup is a breeze. The only thing I have with dreamhost is the domains. They are hosted with rackspace and aws]
At the end of it, you will still have domain registration (not hosting) with your current host, but web hosting on AWS.
If you want to make things more complicated, your DNS hosting could be another service. In this case, you will need to change the DNS servers with your domain registrar to a third party such as DynDNS or others.
The DNS servers will resolve a request to example.com into an IP such as 11.11.11.11. In your case, this should be the AWS elastic IP. In order to make this work, your domain registrar will have DynDNS servers as DNS servers. DynDNS will have A record pointing to your elastic IP.
I hope I am not confusing you.
good luck. You are mostly there. just need a few settings here and there :)