Google App Engine - Static IP Address - Route Domain Name - google-app-engine

I am running a flask application on Google App Engine Standard.
I have not found a resource which states that Google App Engine provides a static IP address. I am trying to route my domain name, let's call it 'mydomain.com' to hit the google app engine endpoint, which Goole provides as something similar to https://my-appengine-name.appspot.com/
I have verified the domain with Google and selected it as a custom domain.
If https://my-appengine-name.appspot.com/ was a numerical IP address I could simply route my domain i.e. 'mydomain.com' to the numerical IP address in the A name record. However, as from what I understand app engine has dynamic IP addresses for APP engine and so this is not possible.
What are my options here to route 'mydomain.com' to Google's App Engine domain: 'https://myappenginename.appspot.com/
' then?

In addition of John comment, if you choose the root domain of your service (in the example, my own domain gblaquiere.dev, a list of IPs (and 1 CNAME) is provided and you have to update your registrar with them
If you absolutely want only one IP to register, you can create an HTTPS Load balancer in front of App Engine and create a serverless NEG backend

Although #guillaume posted correctly above I just wanted to reiterate the steps explicitly. Generally someone asking such a question is a newbie to GCloud and it helps to have explicit steps.
At the App engine dashboard click on settings.
From the settings, click on ADD Custom Domain
To add a domain you needed to verify your domain with Google already, either through adding a TXT record or another method offered by Google (if you haven't registered your domain with Google). This verification can happen almost immediately with Registrars like namecheap.com or name.com (as per my experience)
Then go back to this custom domains area in the Google App Engine console and you will be provided with a list of verified domain you can select to route to your App Engine.
Once you have done this Google will provide you with a series of A, AAAA and a CNAMe record which you will need to update at your Registrar, generally in the advanced DNS settings.
This should definitely be sufficient. I think my struggle resulted due to a problem with my deployed app which I misdiagnosed as a problem with the DNS routing. Thanks for the previous responses which assisted me.

Related

How to configure custom domain for App Engine for service that is not the defautl in GCP?

I have one Node aplication runing on default App Engine service. Its was runing on "urlFromWebSite.appspot.com", and I config it to run in my domain url "customUrl.ai".
I built a second service with Node with name "second-service",and its runing at
"service-two-doturlFromWebSite.appspot.com", but i want to run at "subDomain.customUrl.ai"
I tried dispatch.yaml file with the url that i want for 'second-service';
Stack post 1 talking about dipatch
Stack post 1 talking about dipatch
GCP explanation for dispatch
I have tried Custom domains in App Engine > Settings > Custom domains;
GCP documentation for mapping custom domains
At custom domains I config my subdomain url, and it generates the DNS. ยด
I have question here:
Where should I add this DNS config? At the "customUrl" or should i create a new record set for it?
I have been strugling with it for 2 days already, and could figure it out how to solve it. How should i config this to change my second service's url for a custom subdomain?
When user enters customUrl.ai in a browser, traffic should be routed to Google's servers (for your GAE project). To do that, you configure DNS settings on your domain registrar's end.
When user enters subDomain.customUrl.ai in a browser, traffic should be routed to Google's servers. To do that, you also configure DNS settings on your domain registrar's end.
Both #1 & #2 are done for the same domain on your domain registrar's end (which is GoDaddy in your case). I believe this is what #JohnHanley is referring to. Put another way - just go to GoDaddy, find your domain and create entries corresponding to what GAE has outlined for you. If they are duplicates, GoDaddy will tell you.

How to map only subdomain to App Engine without the naked domain?

My use case is this: I have a domain that points to a server at IP 1.2.3.4 and I would like a subdomain at the domain to point to my App Engine application i.e.
example.com --> 1.2.3.4
app.example.com --> App Engine application
The naked domain as well as the www subdomain must point to the standalone server.
From what I've found out so far, this doesn't seem possible.
Would anyone be able to confirm if this configuration is indeed not possible?
I might actually have a better solution to this.
You can only verify the subdomain.domain.tld with google.
Then you only will add A and AAAA entries to the DNS, with the alias subdomain.
subdomaid.domain.tld will then be independent from domain.tld
After much testing, I've come to the conclusion that the scenario which I've painted is not feasible. So I settled for www.example.com to point to the web server (1.2.3.4) and app.example.com
When users go to the naked domain example.com, they get redirected to www.example.com
Here's what I did:
Remap the naked domain's A records (4 of them, and 4 AAAA records) back to the IP addresses that App Engine suggested.
Added a redirect of the naked domain to the www subdomain, and
Added an A record for www to point to the web server IP (i.e. 1.2.3.4)
Finally, added a CNAME record for app to point to ghs.googlehosted.com so that app.example.com points to the App Engine application.
There might be another option, but I can't really test it for sure as I can't risk it my app ever fails without me knowing.
So from my empirical testing, I was able to set the domain to external hosting and subdomain to GAE:
point main domain to google.
point subdomain to google
wait for certificates to be issued
remove domain from "custom domains" tab (click on the trash can)
point your domain wherever you want
This worked for me for 4 days, in test env, but I couldn't really risk my app of this kind of failure, so I just used the accepted answer at the end (redirect domain to www)
This is definitely possible, I've done it for the exact same scenario:
In App engine, when you verify your domain, only map the subdomain (mysubdomain.example.com). GCP will prepopulate the naked and www domains. Remove them before proceeding.GCP will then provide the A, AAAA, and CNAME records for you to add to your DNS records.
Go to wherever you manage those (Google Domains, GoDaddy, etc), and add all four A's, all four AAAA's and the CNAME yo your subdomain/host
Eventually, gcp should see it's provided records on the DNS records and should issue certificates for https.
On gcp, adjust the dispatch.yaml file to route things to the service I wanted:
dispatch:
- url: "mysubdomain.example.com/*"
service: myservice
Your service should now be accessible via https://mysubdomain.example.com with a pretty padlock to go with it.
Yes, I can confirm this is possible. In fact, it is the recommended way for handling the microservice architecture on App Engine [0].
In your case specifically, all you have to do is create a CNAME with your DNS registrar pointing to ghs.googlehosted.com.
You then have to first verify your TLD with App Engine and add a specific mapping to your subdomain as described here [1].
Let me know if you have any specific questions with the process.
[0] https://cloud.google.com/appengine/docs/standard/python/microservices-on-app-engine
[1] https://cloud.google.com/appengine/docs/standard/python/console/using-custom-domains-and-ssl
I found out it is possible to verify ownership of the whole url, and use that...
App Engine doesn't need to have the A records on the root domain if
you are only serving from a subdomain. App Engine should work properly
for you with just the one CNAME on subdomain.example.com.
Duplicate of App Engine and Firebase Hosting in One Domain
This is the correct answer and is working as expected.

Is it possible to forward CNAME to Google App Engine without adding custom domain

I have this problem when forwarding www CNAME to a Google App Engine application. It's not working maybe I am missing something.
Is it possible to forward CNAME to Google App Engine without adding custom domain?
The documentation you linked actually contains the answer to your question: You have to add a custom domain to your app with a wildcard.
And here is the reason why you have to add every domain to your custom domain.
When you create a cname it will always point to ghs.googlehosted.com. My guess is that the servers behind that domain are one huge load balancer, but that's not really important here. What is important is, that before your HTTP request is made the DNS name is resolved to an IP address. The range of IP addresses is the same for all appengine apps, so the server doesn't know that this particular request is intended for your app. However with that IP address a TCP connection is opened to the server. Now you send a request like:
GET / HTTP/1.1
HOST: www.yourcustomdomain.com
The server looks at the HOST part and must decide which app this request should be forwarded to. But it cannot know that if you didn't add your domain to the custom domains of your project. There simply is no information about where to route that request. So the simple answer is:
Yes you must add all your custom domains to your project, but you could use wildcards
No it will not work without that step, because the Google infrastructure houses tons of apps and your app does not have a dedicated IP address by which it could be identified

SSL Error using custom domain with Google App Engine

I followed the steps detailed here to use a custom domain with google app engine.
I'm the admin of the Google Apps account
I'm the owner of the Google App Engine account
I've added the domain to my Google Apps account through my App Engine account
I see my App Engine app in my Google Apps account
I set the CNAME "test" to point to ghs.googlehosted.com
I added the web address under my Google Apps account and it says "Your users can access my-app-id at: test.mydomain.com
Now when I go to http://test.mydomain.com, it redirects to https://test.mydomain.com and I get an SSL connection error (Unable to make a secure connection to the server.)
I called Google Apps customer support because I have a paid business account, but the customer service guy said that this falls under App Engine support and he was not trained in this issue.
Help!
If you've done everything correctly, you should be able to access your site at http://test.mydomain.com. It sounds from the error you're getting that you're attempting to access it at https://test.mydomain.com (https as opposed to http).
If you want to access your app over SSL at your custom domain, you have more setup to do, as documented here: SSL for a Custom Domain. The steps necessary are many and subject to change; that link is the official source of current information on the matter.
Update: From your updated information, it sounds like you may have secure: always set in your app.yaml, or the Java-configuration equivalent of this setting. It would be helpful if you posted your configuration file.
Also note that it takes several minutes for Google to add a certificate on a domain you recently imported (it may require time for DNS configuration to spread). I personally didn't need to add any secure: configuration, it just worked after some time.

App Engine - Subdomain

I have deployed an application on Google App Engine and I want to link a Subdomian to that application.
I currently have a domain that is linked to a "live" site. from Google documentation I understand that i need to set up my domain with Google Apps:
To serve your app on a custom domain, the domain must be set up with Google Apps
(Source)
What exactly that mean?
I've looked in Google documentation and could get a clear idea...
Does that will effected my "live" site in some way?
just to clarify, www.mydomain.com - points a site that i own and i want sub.mydomain.com to point to my Google application.
You need to make a CNAME to forward to your app address.
Let's say your app address is https://yourapp.appspot.com, and you want sub.mydomain.com to forward to it, just do like below:
Please read THIS first, follow the steps until step 5. You'll need to type your mydomain.com in step 3, and type sub in step 5. After these, you'll some steps on how to Chang CNAME record, just follow:
set your host name to sub
Type: CNAME
IP address/host name: ghs.google.com.
Priority status: (whatever just make it's the number)
OK, and you'll visit your app by http://sub.mydomain.com, different hosting providers have different time to set it valid. :)
BTW, it'll not effect your "live" site in any way. As your main site use mydomain.com, and you just need sub.mydomain.com. What GAE said is that, if you want to set mydomain.com to your app, you need to set A type instead of CNAME type in your host. This domain hosting method includes more steps, you'll see GAE's doc that you found, and so it will effect your live site.
This means you have to register your domain with Google Apps here: https://www.google.com/a/cpanel/domain/new
You don't have to have your main website hosted on Google. Just how you arrange things is determined by how you configure your DNS which you will retain control of. Same for email you can have it delivered to Google Apps or not, depending on your DNS MX records.
You need to validate your ownership using webmasters by adding a txt record in you dns records, after that it will appears in the list of domains under App Engine > Settings > Custom domains.

Resources