Instructions et exigences de configuration de l'atelier
Protégez votre compte et votre progression. Utilisez toujours une fenêtre de navigation privée et les identifiants de l'atelier pour exécuter cet atelier.
Ce contenu n'est pas encore optimisé pour les appareils mobiles.
Pour une expérience optimale, veuillez accéder à notre site sur un ordinateur de bureau en utilisant un lien envoyé par e-mail.
Overview
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.
Les ateliers créent un projet Google Cloud et des ressources pour une durée déterminée.
Les ateliers doivent être effectués dans le délai imparti et ne peuvent pas être mis en pause. Si vous quittez l'atelier, vous devrez le recommencer depuis le début.
En haut à gauche de l'écran, cliquez sur Démarrer l'atelier pour commencer.
Utilisez la navigation privée
Copiez le nom d'utilisateur et le mot de passe fournis pour l'atelier
Cliquez sur Ouvrir la console en navigation privée
Connectez-vous à la console
Connectez-vous à l'aide des identifiants qui vous ont été attribués pour l'atelier. L'utilisation d'autres identifiants peut entraîner des erreurs ou des frais.
Acceptez les conditions d'utilisation et ignorez la page concernant les ressources de récupération des données.
Ne cliquez pas sur Terminer l'atelier, à moins que vous n'ayez terminé l'atelier ou que vous ne vouliez le recommencer, car cela effacera votre travail et supprimera le projet.
Ce contenu n'est pas disponible pour le moment
Nous vous préviendrons par e-mail lorsqu'il sera disponible
Parfait !
Nous vous contacterons par e-mail s'il devient disponible
Un atelier à la fois
Confirmez pour mettre fin à tous les ateliers existants et démarrer celui-ci
Utilisez la navigation privée pour effectuer l'atelier
Le meilleur moyen d'exécuter cet atelier consiste à utiliser une fenêtre de navigation privée. Vous éviterez ainsi les conflits entre votre compte personnel et le compte temporaire de participant, qui pourraient entraîner des frais supplémentaires facturés sur votre compte personnel.
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.
Durée :
0 min de configuration
·
Accessible pendant 90 min
·
Terminé après 90 min