- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Understanding Service Accounts on Google Compute Engine
In this lab, we create a custom service account with granular IAM permissions, then use the service account when creating a Compute Engine instance that will run the WordPress blogging software connected to a Cloud SQL database.

Lab Info
Table of Contents
-
Challenge
Create a Cloud SQL Instance
- Create a new Cloud SQL MySQL instance with the name wordpress-db.
- Generate a root password and note it for later.
- Make sure you have the Region set as us-central1 and the Zone as Any.
- Under Connectivity, tick Private IP.
- Enable Service Networking API.
- Under Associated networking, select the default Network.
- Choose to use an automatically allocated IP range.
- Untick Public IP to remove public IP connections from this instance.
- Change the machine type to Shared Core, 1 vCPU, 1.7 GB..
-
Challenge
Create a Custom Service Account
- Create a new service account named wordpress-app.
- When prompted to Grant this service account access to project, type SQL in the Select a role box to search roles, then select Cloud SQL Client.
-
Challenge
Create the WordPress Instance on Compute Engine
- Create a new instance named wordpress.
- Set the Region to us-central1 (the console will choose a zone for you).
- Change the Machine type to e2-small.
- Have the instance deploy a container to the VM instance, and use the container wordpress.
- For our service account, make sure to select wordpress-app.
- Allow all HTTP traffic on the instance.
- Use the VM's External IP link to see the WordPress language selection screen.
-
Challenge
Set Up WordPress and the Database
Before we configure WordPress, we must first create the database inside our new Cloud SQL instance.
- Take note of the private IP for our wordpress-db instance.
- Create a new database with the name wordpress.
Complete the rest of these steps in WordPress:
- Choose your preferred language, then on the next screen click Let's go!.
- Update the connection details to match the following:
- Database name: wordpress
- Username: root
- Password: The root password you noted earlier.
- Database Host: The private IP you noted earlier.
- Table Prefix: wp_
- Run the installation.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.