Firewall – cannot open port 8000 in google compute instance

firewallgoogle-compute-engine

Check one – Application is running or not port 8000 in the GCP instance

kranthi@xxx-dev-xxx:~$ netstat -tlpn | grep 8000
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0       0 0.0.0.0:8000            0.0.0.0:*               LISTEN      22051/python  

check two — check firewall rules and applied instance tags from my pc

kranthi@xxxxxxxx:~$ gcloud compute firewall-rules describe django- 
dev-env --format="value(targetTags)"
xxx-dev-kranthi;xxx-dev-xxx
kranthi@xxxxxxxx:~$ 

check three — check instance tag

kranthi@xxxxxxxxx:~$ gcloud compute instances list -- 
filter='tags:fdst-dev-blr1' --format='table(name,status,tags.items)'
NAME           STATUS   ITEMS
xxx-dev-xxx  RUNNING  [u'xxx-dev-xxx', u'http-server', u'https-server']

We see instance with hostname xxx-dev-xxx is given network tag xxx-dev-xxx.

The firewall rule django-
dev-env is also having the tag xxx-dev-xxx

Best Answer

I just resolved question while I was writing this question. I had an extra firewall tag on compute instance which after removing I could telnet the server with port 8000