Skip to main content

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 the Public network.

Fig. Auto-generated subnet example

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., choose europe-west1-b and europe-west1-c for Compute and Compute_2, respectively).

Fig. Choose zone europe-west1-b for compute

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 region europe-west1 in the Private network.
  • The subnet has the same cidr of the Private network (i.e., 10.0.0.0/24).
  • Both computes Compute and Compute-2 connect to this subnet.

Fig. One subnet is auto-generated

  • The routing_mode of the Private network is set to REGIONAL by default (since all computes are in the same region).

Fig. The routing_mode is auto set to REGIONAL

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 and europe-west1-c for Compute and Compute_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 and europe-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 and 10.0.0.128/25).
  • Two computes connect to two separated subnets in different regions.

Fig. Two subnets are auto-generated

  • The routing_mode of the Private network is set to GLOBAL by default so that the two computes from different regions can access each other via the internal IP address.

Fig. The routing_mode is auto set to GLOBAL

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.