1
votes

I created a google compute instance on https://console.cloud.google.com/compute/instances

After that I deployed a jar file embedded jetty server running on port 8082. I execute the jar file with java -jar command.

In VPC network I add a firewall rule to open port 8082. Now if I try to access the google instance at port 8082 in web browser I am getting connection refused error. Below is the external ip address with port

http://35.184.211.81:8082

I don't know why above external ip is not working. If I open cloud shell and open web preview on port 8082 then I am able to access my web application on port 8082 below is the url

https://8082-dot-3144491-dot-devshell.appspot.com

It looks confusing. Above adress is showing that my application is deployed on google cloud instance but it is not accessible using external ip.

1
I don't know what the cause is, but "connection refused" means the IP is reachable, but the port is not allowed.Dagang

1 Answers

0
votes

I solved above issue by myself.

The problem was that I was using google cloud shell to deploy my application. I run the java -jar command in google cloud shell. I don't know why changes made or program executed in google cloud shell are temporary so that's the reason my application wasn't accessible on external IP.

I connected my instance using SSH, run the jar file and then my application is accessible on external IP with port. In https://console.cloud.google.com there is an option to connect the instance with SSH so i use that option.