How to do it...

Once the network and subnets are created, we'll create instances in the subnets and try to establish a communication. As there is no connectivity, the communication will fail. Next, we'll establish VPC peering to connect the two networks and verify the communication between the instance created:

  1. Let's create a VM in the subnet alpha-subnet-1 with default attributes:
gcloud beta compute instances create "alpha-instance" \--zone "us-central1-a" --machine-type "n1-standard-1" \--subnet "alpha-subnet-1" --image "debian-9-stretch-v20171213" \--image-project "debian-cloud"
  1. We'll create a firewall rule for all SSH and ICMP traffic in the network alpha:
gcloud compute firewall-rules create alpha-firewall --network alpha --allow ...

Get Google Cloud Platform Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.