COMS W4111.001-Introduction to Databases
Fall 2023

Ports and Google Cloud

Opening a Port on Google Cloud

By default, Google Cloud puts your virtual machine behind a firewall, so it is not accessible from the internet. This is because anything that is accessible on the 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 "Networks," with network firewall rules. When a virtual machine is created, it is placed in a project. All the virtual machines in that project have the same firewall rules applied. To make a port accessible, you need to edit the networks settings for the VM instances, as follows.

  1. Go to your Google Cloud portal page for your virtual machine
  2. Once your Compute Engine is set up and ready, click on its name to go to its settings page (see the leftmost arrow in the diagram below)”

  3. Click on the "Network" link (see below); next, click on the "Firewall rules" tab and then on the "Create firewall rule" button to create a new rule with the following settings:

    • Name: "allow-flask" (or something similar)
    • Targets: All instances in the Network
    • Source IPv4 ranges: 0.0.0.0/0
    • Specified protocols and ports: tcp:8111

You can now connect to your virtual machine at http://<YOURIP>:8111/