Design your application with dynamic subnets
The previous tutorial shows how to define multiple subnets for a network explicitly. However, users may not want to define the subnets explicitly. In such a case, the Cloud Topology Designer will auto-generate one subnet for each region dynamically as follows:
Step 1. Design
- Design an application with two computes connecting to the same
Private
network. The Private network has no subnets. - Click on the
Private
network and specify the cidr:10.0.0.0/24
. - Connect the first compute (e.g.,
Compute
) to thePublic
network.
Step 2. Deploy
Case 1. Two computes in the same region
- Choose the Google Cloud location to deploy.
- In the matching tab, choose the zone for the two computes in the same region
europe-west1
(e.g., chooseeurope-west1-b
andeurope-west1-c
forCompute
andCompute_2
, respectively).
Expected result
Click on the Topology tab to review the topology before the deployment:
- The subnet
Private_subnet_europe_west1
is auto-generated for the regioneurope-west1
in thePrivate
network. - The subnet has the same cidr of the
Private
network (i.e.,10.0.0.0/24
). - Both computes
Compute
andCompute-2
connect to this subnet.
- The
routing_mode
of thePrivate
network is set toREGIONAL
by default (since all computes are in the same region).
Case 2. Two computes in different regions
- In the matching tab, choose the zone for the computes in two different regions (e.g., choose the zone
europe-north1-a
andeurope-west1-c
forCompute
andCompute_2
, respectively).
Expected result
Click on the Topology tab to review the topology before the deployment:
- Two subnets are auto-generated for the region
europe-north1
andeurope-west1
. - The cidr of the
Private
network (i.e.,10.0.0.0/24
) is auto subnetting in two equal ranges for each subnet (i.e.,10.0.0.0/25
and10.0.0.128/25
). - Two computes connect to two separated subnets in different regions.
- The
routing_mode
of thePrivate
network is set toGLOBAL
by default so that the two computes from different regions can access each other via the internal IP address.
tip
Auto-generated subnet is useful if you cannot decide the location of the computes at the design time (i.e., whether the computes are co-located in one or in different regions) but at the deployment time. In such a case, the Cloud Topology Designer will transform the topology before the deployment for you.