
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you restart it, you'll have to start from the beginning.
- On the top left of your screen, click Start lab to begin
Create the blue server
/ 15
Create the green server
/ 15
Install Nginx and customize the welcome page
/ 30
Create the tagged firewall rule
/ 15
Create a test-vm
/ 10
Create a Network-admin service account
/ 15
In the real-world you need to protect sensitive data and ensure the continued availability of your web applications at all times. Learn how to use the Google Cloud VPC network to create a more secure, scalable, and manageable web server deployment within your Google Cloud environment.
In this lab, you create two nginx web servers on the default VPC network and control external HTTP access to the web servers using tagged firewall rules. Then, you explore IAM roles and service accounts.
In this lab, you learn how to perform the following tasks:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
In this section, you will create two web servers (blue and green) in the default VPC network. Then, you will install nginx on the web servers and modify the welcome page to distinguish the servers.
Create the blue server with a network tag.
In the Cloud console, navigate to Navigation menu () > Compute Engine > VM instances.
To create a new instance, click Create Instance.
In the Machine configuration.
Select the following values:
Property | Value (type value or select option as specified) |
---|---|
Name | blue |
Region | |
Zone |
For more information on available regions and zones, in the Google Cloud Compute Engine Region and Zone guide, see the Available regions and zones section of the Compute Engine Guides.
Click Networking.
web-server
.Click Create.
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
Create the green server without a network tag.
Still in the Console, on the VM instances page, click Create Instance.
In the Machine configuration.
Select the following values:
Property | Value (type value or select option as specified) |
---|---|
Name | green |
Region | |
Zone |
Click Create.
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
Install nginx on both VM instances and modify the welcome page to distinguish the servers.
Still in the VM instances dialog, for blue, click SSH to launch a terminal and connect.
In the SSH terminal to blue, run the following command to install nginx:
<h1>Welcome to nginx!</h1>
line with <h1>Welcome to the blue server!</h1>
.The output should contain the following:
Repeat the same steps for the green server:
<h1>Welcome to nginx!</h1>
line with <h1>Welcome to the green server!</h1>
.The output should contain the following:
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
Create the tagged firewall rule and test HTTP connectivity.
Create a firewall rule that applies to VM instances with the web-server network tag.
Click Create Firewall Rule.
Set the following values, leave all other values at their defaults.
Property | Value (type value or select option as specified) |
---|---|
Name | allow-http-web-server |
Network | default |
Targets | Specified target tags |
Target tags | web-server |
Source filter | IPv4 Ranges |
Source IPv4 ranges | 0.0.0.0/0 |
Protocols and ports | Specified protocols and ports, and then check tcp, type: 80; and check Other protocols, type: icmp. |
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
Create a test-vm instance using the Cloud Shell command line.
Open a new Cloud Shell terminal.
Run the following command to create a test-vm instance, in the
The output should look like this:
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
From the test-vm, curl
the internal and external IP addresses of blue and green.
You should see the Welcome to the blue server!
header.
You should see the Welcome to the green server!
header.
You should see the Welcome to the blue server!
header.
You can verify the same behavior from your browser by opening a new tab and navigating to http://[External IP of server]
.
Cloud IAM lets you authorize who can take action on specific resources, giving you full control and visibility to manage cloud resources centrally. The following roles are used in conjunction with single-project networking to independently control administrative access to each VPC Network:
Explore these roles by applying them to a service account, which is a special Google account that belongs to your VM instance, instead of to an individual end user. Rather than creating a new user, you will authorize test-vm to use the service account to demonstrate the permissions of the Network Admin and Security Admin roles.
Currently, test-vm uses the Compute Engine default service account, which is enabled on all instances created by Cloud Shell command-line and the Cloud Console.
Try to list or delete the available firewall rules from test-vm.
The output should look like this:
The output should look like this:
Create a service account and apply the Network Admin role.
In the Console, navigate to Navigation menu () > IAM & admin > Service Accounts.
Notice the Compute Engine default service account.
Click Create service account.
Set the Service account name to Network-admin
and click CREATE AND CONTINUE.
For Select a role, select Compute Engine > Compute Network Admin and click CONTINUE then click DONE.
After creating the service account Network-admin
, click on the three dots at the right corner and click Manage Keys in the dropdown, then click on Add Key and select Create new key from the dropdown. Click Create to download your JSON output.
Click Close.
A JSON key file download to your local computer. Find this key file, you will upload it into the VM in a later step.
Rename the JSON key file on your local machine to credentials.json
Click Check my progress to verify your performed task. If you have completed the task successfully you will be granted an assessment score.
Authorize test-vm to use the Network-admin service account.
The output should look like this:
This should work!
The output should look like this:
Update the Network-admin service account by providing it the Security Admin role.
In the Console, navigate to Navigation menu () > IAM & admin > IAM.
Find the Network-admin account. Focus on the Name column to identify this account.
Click on the pencil icon for the Network-admin account.
Change Role to Compute Engine > Compute Security Admin.
Click Save.
Return to the SSH terminal of the test-vm instance.
Try to list the available firewall rules:
The output should look like this:
This should work!
The output should look like this:
This should work!
Verify that you can no longer HTTP access the external IP of the blue server, because you deleted the allow-http-web-server firewall rule.
In this lab, you created two nginx web servers and controlled external HTTP access using a tagged firewall rule. Then, you created a service account with first the Network Admin role and used the Security Admin role to explore the different permissions of these roles.
Learn more about service accounts and roles with this lab:
For information on the basic concepts of Google Cloud Identity and Access Management, see Google Cloud Identity and Access Management Overview
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated December 11, 2024
Lab Last Tested October 01, 2024
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one