Can't access Google Cloud Compute engine external IP to access flask app

Viewed 851

i've build a simple flask app on my google cloud GCE instance, but i can't access it from another computer, here's the simple flask app that i've build :

from flask import Flask, render_template, request, json, abort
app = Flask(__name__)
@app.route('/', methods=['GET'])
def heartbeat():
  return 'hello'
if __name__ == '__main__':
  app.run(host='0.0.0.0', port=5000)

and when i run the app

and when i run the app

and access the external IP of my machine it only said this site can't be reached it only said this site can't be reached i have set up a new firewall rule set up a new firewall rule but it still not working.

3 Answers

It's because you've to change the port to 80 instead of 5000

with me it was the silly problem that when you click on the link to the external IP on the GCP console you get send to https://34.##.#.## and that doesn't work but if you go to 34.##.#.##:5000 it did work for me. Also doing a "curl 34.##.#.##:5000" on linux also works for me

When I did this my problem was I didnt configure the windows firewall correctly at first. Make sure to allow inbound rules like this:

enter image description here

Related