In this codelab, you'll spin up some VMs in the default network and explore connectivity.
The goal here is simple: to get comfortable with the components of networking that affect instances. Later, you'll configure instances and networks in more detail.
Sign in as the owner of a free-trial GCP account or as a user with project owner access to a billing-enabled project.
Go to the main menu icon and select Networking > VPC Networks.
You'll see a list of networks in the currently selected project. You'll see the default network which gets automatically created for you in each project. It lists default subnets with preset IP address ranges in each region like the following:
To add an instance to the default network, go to the main menu and select Compute Engine > VM instances.
Select a project linked to a free-trial billing account if you have one.
Give it a name unique to the project, like web-vm.
Select a zone for its physical location that's close to you. Remember, there must be a network and subnet covering your chosen zone.
Under Machine Type, click the drop-down to see a list of predefined CPU and RAM combinations.
Click the Customize link to the right to see how to customize the configuration.
Click Basic View and choose the micro config from the drop-down for now (it's the cheapest).
Each instance comes with a boot disk and operating system. Select the latest Debian image.
Under Firewall, you can specify whether to open the firewall for HTTP traffic on port 80. Leave it blank for now.
Click Management, disk, networking, SSH keys for more settings.
Click Networking to see which network is selected.
Leave the internal IP address set to automatic and the external IP address set to ephemeral (it'll be set for you).
While that's processing, let's look at the default network.
Go to the main menu and select Networking > Networks.
Click the default network to see what's in it and what you can do with it.
You'll see preset subnets, but not be able to add any.
Click one their links and click Edit. You'll see there's very little you can edit.
Go back to the default network page.
Now check the status of your instance.
Return to Compute Engine > VM Instances.
See how it has an internal and external IP address.
Click the SSH button to the right of the instance to logon. Remember, you need a firewall rule to allow inbound SSH from anywhere to do this, and the default network has one and the Admin Console has a project-wide SSH key it can use to log in.
A command shell opens and signs you in. See your username and instance in the prompt.
From the command shell, ping a host on the Internet like wikipedia.com.
Ping your VM instance from a host outside your GCP network, like your local laptop, using its external IP address.
Add a second instance to the network but put it in a different region and subnet.
SSH into the second instance from Admin Console and ping your first instance using its internal address.
Then return to the command shell for your first instance and ping the second. These also work.
Run sudo route in an instance's SSH window to see how they found each other.
From there, traffic to subnets is routed using the virtual network.
To see this, go to Networking > Routes and look for one of the destination subnets.
For now, delete your instances, but keep your project.
Here are some tips for navigating faster in Cloud Console.
Pin frequently used menu items to the top of the list:
Type Crtl-O to see your list of projects.
Type '?' to see the full list of keyboard shortcuts.