Design your application with static subnets in multiple regions

The following tutorial describes how to design an application with one (global) private network spanning in two regions of Google Cloud. Each region has one subnet and one compute node connecting to the subnet (e.g., Compute connects to Subnet, Compute_2 connects to Subnet_2). The compute in the first region (e.g., Compute) has access to the internet.

Fig. Multiple subnets example

Step 1. Define a subnet for the network

  • Drop the Subnet component on the Private network node.

Fig. Define a subnet

Step 2. Connect a compute to the subnet

  • Click on the network point (on the right side of the Compute node) and connect it to the connection point (on the left side) of the Subnet node.

Fig. Connect a compute to the subnet

Step 3. Define a cidr range for the subnet

  • Click on the Subnet node.
  • Type 10.0.0.0/24 in the cidr field.

Fig. Define cidr

note
  • The cidr field is mandatory for defining a subnet.

Step 4. Define a fixed ip address for the compute (optional)

  • Click on the Port of the compute.
  • Type 10.0.0.3 in the ip_address field. The ip_address 10.0.0.3 is within the range of the network above (10.0.0.0/24).

Fig. Define fixed ip address

note
  • If no ip_address specified, an ip address will be auto-generated within the ip range of the subnet during the deployment.

Step 5. Define the second compute and subnet

  • Drop another Subnet component on the Private network node. Now we have two subnets: Subnet and Subnet_2.
  • Click on the Subnet_2 node. Type 10.0.1.0/24 in the cidr field.
  • Drop another Compute component (e.g., Compute_2) and connect it to Subnet_2.

Fig. Define second subnet

Step 6. Connect the first compute to the public

  • Drop a Public network node.
  • Connect the Port node of Compute to the link point (on the left side) of the Public network node.

Fig. Connect compute to public

Step 7. Deploy

  • Choose the Google Cloud location to deploy
  • In the matching tab, choose the zone for the computes in different regions (e.g., europe-north1-a for Compute and europe-west1-c for Compute_2).

Fig. Choose availability zone

Expected result

  • The vpc private network is created with two subnets (e.g., private-subnet and private-subnet-2) in two cidr ranges (10.0.0.0/24 and 10.0.1.0/24) and in two regions (e.g., europe-north1 and europe-west1), respectively.

Fig. The HelloWorld example

  • Two VMs will be created in the two separated subnets.
  • Compute-0 has a fixed ip address 10.0.0.3 (as specified in step 4) and has an external IP.

Fig. The HelloWorld example