In this lab, you create two nginx web servers and control external HTTP access to the web servers using tagged firewall rules. Then you explore IAM roles and service accounts.
Objectives
In this lab, you learn how to perform the following tasks:
Create an nginx web server
Create tagged firewall rules
Create a service account with IAM roles
Explore permissions for the Network Admin and Security Admin roles
Setup and requirements
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Google Skills using an incognito window.
Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Task 1. Create the web servers
Create two web servers (blue and green) in the default VPC network. Then install nginx on the web servers and modify the welcome page to distinguish the servers.
Create the blue server
Create the blue server with a network tag.
In the Cloud Console, on the Navigation menu (), click Compute Engine > VM instances.
Click Create Instance.
Specify the following, and leave the remaining settings as their defaults:
Property
Value (type value or select option as specified)
Name
blue
Region
Zone
Click Networking.
For Network tags, type web-server.
Note: Network tags are used by networks to identify which VM instances are subject to certain firewall rules and network routes. In the next task, you create a firewall rule to allow HTTP access for VM instances with the web-server tag.
Alternatively, you could select the Allow HTTP traffic checkbox, which would tag this instance as http-server and create the tagged firewall rule for tcp:80 for you.
Click Create.
Create the green server
Create the green server without a network tag.
Click Create instance.
Specify the following, and leave the remaining settings as their defaults:
Property
Value (type value or select option as specified)
Name
green
Region
Zone
Click Create.
Install nginx and customize the welcome page
Install nginx on both VM instances and modify the welcome page to distinguish the servers.
For blue, click SSH to launch a terminal and connect.
Run the following command to install nginx:
sudo apt-get install nginx-light -y
Run the following command to open the welcome page in the nano editor:
sudo nano /var/www/html/index.nginx-debian.html
Replace the <h1>Welcome to nginx!</h1> line with <h1>Welcome to the blue server!</h1>.
Press CTRL+O, ENTER, CTRL+X.
Run the following command to verify the change:
cat /var/www/html/index.nginx-debian.html
The output should contain the following:
...
<h1>Welcome to the blue server!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
...
Close the SSH terminal to blue:
exit
Repeat the same steps for the green server:
For green, click SSH to launch a terminal and connect.
Run the following command to install nginx:
sudo apt-get install nginx-light -y
Run the following command, to open the welcome page in the nano editor:
sudo nano /var/www/html/index.nginx-debian.html
Replace the <h1>Welcome to nginx!</h1> line with <h1>Welcome to the green server!</h1>.
Press CTRL+O, ENTER, CTRL+X.
Run the following command to verify the change:
cat /var/www/html/index.nginx-debian.html
The output should contain the following:
...
<h1>Welcome to the green server!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
...
Close the SSH terminal to green:
exit
Click Check my progress to verify the objective.
Create the web servers
Task 2. Create the firewall rule
Create the tagged firewall rule and test HTTP connectivity.
Create the tagged firewall rule
Create a firewall rule that applies to VM instances with the web-server network tag.
In the Cloud Console, on the Navigation menu, click VPC network > Firewall.
Notice the default-allow-internal firewall rule.
Note: The default-allow-internal firewall rule allows traffic on all protocols/ports within the default network. You want to create a firewall rule to allow traffic from outside this network to only the blue server, by using the network tag web-server.
Click Create Firewall Rule.
Specify the following, and leave the remaining settings as 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
For tcp, specify port 80.
Note: Make sure to include the /0 in the Source IPv4 ranges to specify all networks.
Click Create.
Create a test-vm
Create a test-vm instance using the gcloud command line.
In the Cloud Console, click Activate Cloud Shell ().
If prompted, click Continue.
Run the following command to create a test-vm instance:
The output should look similar to what is shown below. (Note that the zone may be different.)
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
test-vm us-central1-a e2-medium 10.142.0.4 35.237.134.68 RUNNING
Note: You can easily create VM instances from the Cloud Console or the gcloud command line.
Click Check my progress to verify the objective.
Create the firewall rule and instance
Test HTTP connectivity
From test-vmcurl the internal and external IP addresses of blue and green.
In the Cloud Console, on the Navigation menu, click Compute Engine > VM instances.
Note the internal and external IP addresses of blue and green.
For test-vm, click SSH to launch a terminal and connect.
To test HTTP connectivity to blue's internal IP, run the following command, replacing blue's internal IP:
curl <Enter blue's internal IP here>
You should see the Welcome to the blue server! header.
To test HTTP connectivity to green's internal IP, run the following command, replacing green's internal IP:
curl <Enter green's internal IP here>
You should see the Welcome to the green server! header.
Note: You can HTTP access both servers using their internal IP addresses. The connection on tcp:80 is allowed by the default-allow-internal firewall rule, because test-vm is on the same VPC network as the web servers (default network).
To test HTTP connectivity to blue's external IP, run the following command, replacing blue's external IP:
curl <Enter blue's external IP here>
You should see the Welcome to the blue server! header.
To test HTTP connectivity to green's external IP, run the following command, replacing green's external IP:
curl <Enter green's external IP here>
Note: This should not work!
Press CTRL+C to stop the HTTP request.
Note: As expected, you can only HTTP access the external IP address of the blue server, because the allow-http-web-server only applies to VM instances with the web-server tag.
To verify the same behavior from your browser, open a new tab and navigate to http://[External IP of server].
Task 3. Explore the Network and Security Admin roles
Cloud IAM lets you authorize who can take action on specific resources, which give 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:
Network Admin: Permissions to create, modify, and delete networking resources, except for firewall rules and SSL certificates.
Security Admin: Permissions to create, modify, and delete firewall rules and SSL certificates.
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. You will authorize test-vm to use the service account to demonstrate the permissions of the Network Admin and Security Admin roles, instead of creating a new user.
Verify current permissions
Currently, test-vm uses the Compute Engine default service account, which is enabled on all instances created by the gcloud command-line tool and the Cloud Console.
Try to list or delete the available firewall rules from test-vm.
Return to the SSH terminal of the test-vm instance.
Run the following command to try to list the available firewall rules:
gcloud compute firewall-rules list
The output should look like this:
ERROR: (gcloud.compute.firewall-rules.list) Some requests did not succeed:
- Insufficient Permission
Note: This should not work!
Run the following command to try to delete the allow-http-web-server firewall rule:
ERROR: (gcloud.compute.firewall-rules.delete) Could not fetch resource:
- Insufficient Permission
Note: This should not work!
Note: The Compute Engine default service account does not have the right permissions to allow you to list or delete firewall rules. The same applies to other users who do not have the right roles.
Create a service account
Create a service account and apply the Network Admin role.
In the Cloud Console, on the Navigation menu (), click IAM & admin > Service accounts.
Notice the Compute Engine default service account.
Click Create service account.
Set the Service account name to Network-admin.
Click Create and Continue.
For Select a role, select Compute Engine > Compute Network Admin.
Click Continue.
Click Done.
Note: Optionally you could create and download a file that contains the private key. However, we can just stop test-vm and authorize it to use the service account.
Authorize test-vm
Authorize test-vm to use the Network-admin service account.
On the Navigation menu, click Compute Engine > VM instances.
Click on the name of the test-vm instance to open the VM instance details page.
Click Stop and confirm to Stop the instance. Wait for the instance to stop before proceeding to the next step.
Note: An instance must be stopped to edit its service account.
Once the instance stopped, click Edit.
Select Network-admin for Service account.
For Access Scopes, select Set access for each API, and in the Compute Engine dropdown, choose the Read/Write option
Click Save and wait for the instance to update.
Click Start and confirm to Start the instance.
Return to the Vm instances page and wait for test-vm to change to a running state.
Click SSH for the test-vm instance.
Verify permissions
Run the following command to try to list the available firewall rules:
ERROR: (gcloud.compute.firewall-rules.delete) Could not fetch resource:
- Required 'compute.firewalls.delete' permission for 'projects/[PROJECT_ID]/global/firewalls/allow-http-web-server'
Note: This should not work!
Note: As expected, the Network Admin role has permissions to list but not modify/delete firewall rules.
Update service account and verify permissions
Update the Network-admin service account by providing it with the Security Admin role.
In the Cloud Console, on the Navigation menu (), click 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.
Run the following command to try to list the available firewall rules:
Note: As expected, the Security Admin role has permissions to list and delete firewall rules.
Verify the deletion of the firewall rule
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.
Return to the SSH terminal of the test-vm instance.
To test HTTP connectivity to blue's external IP, run the following command, replacing blue's external IP:
curl <Enter blue's external IP here>
Note: This should not work!
Press CTRL+C to stop the HTTP request.
Note: Provide the Security Admin role to the right user or service account to avoid any unwanted changes to your firewall rules!
Click Check my progress to verify the objective.
Explore the Network and Security Admin roles
Task 4. Review
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 then the Security Admin role to explore the different permissions of these roles.
If your company has a security team that manages firewalls and SSL certificates and a networking team that manages the rest of the networking resources, grant the security team the Security Admin role and the networking team the Network Admin role.
End your lab
When you have completed your lab, click End Lab. Google Skills removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
1 star = Very dissatisfied
2 stars = Dissatisfied
3 stars = Neutral
4 stars = Satisfied
5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2026 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.
실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.
시크릿 브라우징 사용
실습에 입력한 사용자 이름과 비밀번호를 복사합니다.
비공개 모드에서 콘솔 열기를 클릭합니다.
콘솔에 로그인
실습 사용자 인증 정보를 사용하여
로그인합니다. 다른 사용자 인증 정보를 사용하면 오류가 발생하거나 요금이 부과될 수 있습니다.
약관에 동의하고 리소스 복구 페이지를 건너뜁니다.
실습을 완료했거나 다시 시작하려고 하는 경우가 아니면 실습 종료를 클릭하지 마세요. 이 버튼을 클릭하면 작업 내용이 지워지고 프로젝트가 삭제됩니다.
현재 이 콘텐츠를 이용할 수 없습니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
감사합니다
이용할 수 있게 되면 이메일로 알려드리겠습니다.
한 번에 실습 1개만 가능
모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.
시크릿 브라우징을 사용하여 실습 실행하기
이 실습을 실행하는 가장 좋은 방법은 시크릿 모드 또는 시크릿 브라우저 창을 사용하는 것입니다. 개인 계정과 학생 계정 간의 충돌로 개인 계정에 추가 요금이 발생하는 일을 방지해 줍니다.
In this lab, you create two nginx web servers and control external HTTP access to the web servers using tagged firewall rules. Then, you explore IAM policies and service accounts.