Opening a Port on Google Cloud
By default, Google Cloud (and other cloud platforms) put your virtual machine behind a firewall, so it is not accessible from the Internet. This is because anything that is accessible on the public Internet is constantly being probed by hackers. To make your Python web application accessible to anyone, as you need to do for this project, you will need to follow the steps below. Please make sure you don't put any valuable data on the virtual machine.
Google Cloud has the concept of a "Networks" that contains a set of network firework rules. When a virtual machine is created, it is placed in a project. All the virtual machines in that project have the same rules applied. To make a port accessible, you need to edit the networks settings for the instance
- Go to your Google Cloud portal page for your virtual machine.
- Once the Compute Engine is setup and ready click on the instance link
- Click on the Network setting link. Add the required Firewall rules using the "Add Firewal Rule" button. Also add a rule for Source IP range as 0.0.0.0/0 and Allowed Protocols: tcp:8111
You can now connect to your virtual machine at http://(YOURIP):8111/