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 Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.