4

I am trying to access my Tomcat HomePage which is inside my Google Cloud VM Instance with External IP address 35.189.85.127 and Internal IP 10.154.0.2. On my local machine, in my browser I tried http://35.189.85.127 and http://35.189.85.127:8080 but got error

The connection has timed out. The server at 35.189.85.127 is taking too long to respond.

I have seen all the questions and replies on stackoverflow regarding this question but still I found no clear solution.

The steps that I've done so far:

  1. I have setup a Google Cloud VM instance in Compute Engine. I am using Windows Server 2016 as the image.
  2. Using RDP I log on to Windows Server.
  3. I successfully installed Java 1.7 and Tomcat 7 on Windows Server.
  4. I tested Java and Tomcat 7, both are working fine i.e. I open browser and type localhost:8080 and it shows Tomcat HomePage.
  5. I replaced localhost with my VM Instance Internal IP i.e. 10.154.0.2:8080 and it again correctly shows Tomcat HomePage.
  6. Now I try to access Tomcat HomePage using my VM Instance External IP (Static) 35.189.85.127 but in my browser I get error

The connection has timed out. The server at 35.189.85.127 is taking too long to respond.

James Z
  • 11,838
  • 10
  • 25
  • 41
Newbie
  • 67
  • 2
  • 6

2 Answers2

4

Faced the same issue today.

Noticed from your question that you're using an Windows environment.

On Windows

Be sure that the Windows Firewall is properly configured to allow traffic under the ports you need (or deactivate it).

On GCP

Under "VPC Network/Firewall Rules", create a new firewall rule and configure as below:

Firewall Rule Parameters (image)

Or, you have the option to check the "Allow HTTP traffic" option under the Instance Configuration menu and edit Tomcat's server.xml to startup at port 80, as described here:

Change Tomcat Port Tutorial @ StackOverflow

Leo Vesque
  • 71
  • 3
0

Option1: If it's just tomcat. GCP offers a click to launch Tomcat instance with an external IP. You can SSH and also have a temp tomcat username and password to manage any of your deployments. https://console.cloud.google.com/launcher/details/click-to-deploy-images/tomcat

Option 2: If you wish to have a Google Cloud VM instance in Compute Engine. You will need to setup security groups and assign it to your instance. Eg. Define rules to Open Tomcat port 8080(or any) externally / range. Assign that group/rule to your VM instance. There are many options available, it all depends on how you wish to organize things. You could create a VPC and add your instances there or keep them under the same subnet or have them accessible externally etc.

Karthik tv
  • 99
  • 1
  • 7
  • Thank you for replying. I really appreciate it. I think I will go with Option 2. But as per my name, I am a Newbie to Google Cloud. Could you guide me on how to go about this? We can also chat if its possible for you. Kindly let me know. – Newbie Sep 01 '17 at 03:49
  • Hi Newbie, If wanted to go with Option 2 and have issues accessing with External IP. Click on Google Cloud Platform -> VPC network -> Firewall rules. [This in AWS is called security groups] Add an ingress rule. Give it a name, targets should be your Tomcat instance server / group of servers/Apply to all (you decide). Source IP rage would be 0.0.0.0/0 [as all external] and protocol would be "tcp 8080" [looking at your question, you set Tomcat port as 8080], allow this rule. And you should be set. and yes we can have a chat. IM / PM me the details. – Karthik tv Sep 09 '17 at 16:06