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 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.
Design¶
Step 1. Define a subnet for the network¶
Drop the Subnet component on the Private network.
Step 2. Connect a compute to the subnet¶
Click on the network point (on the right side of the Compute) and connect it to the connection point of the Subnet.
Step 3. Define a CIDR range for the subnet¶
Click on the Subnet.
Type
10.0.0.0/24
in the cidr field.
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_address10.0.0.3
is within the range of the network above (10.0.0.0/24
).
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. Now we have two subnets:
Subnet
andSubnet_2
.Click on the Subnet_2. Type
10.0.1.0/24
in the cidr field.Drop another Compute component (e.g.,
Compute_2
) and connect it to Subnet_2.
Step 6. Connect the first compute to the public¶
Drop a Public network.
Connect the Port of
Compute
to the link point (on the left side) of the Public network.
Deploy¶
Go to Deploy.
Choose the Google provider.
In the Configure cloud provider:
Choose the zone for the computes in different regions (e.g.,
europe-north1-a
forCompute
andeurope-west1-c
forCompute_2
).
In summary, we have two computes with two subnets in two different regions:
Expected result¶
The VPC
private
network is created with two subnets (e.g.,private-subnet
andprivate-subnet-2
) in two cidr ranges (10.0.0.0/24
and10.0.1.0/24
) and in two regions (e.g.,europe-north1
andeurope-west1
), respectively.
Two VMs will be created in the two separated subnets.
Compute-0
has a fixed ip address10.0.0.3
(as specified in step 4) and has an external IP.