Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru

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.


Path Info

Clock icon Beginner
Clock icon 30m
Clock icon Apr 09, 2021

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a Cloud SQL Instance

    1. Create a new Cloud SQL MySQL instance with the name wordpress-db.
    2. Generate a root password and note it for later.
    3. Make sure you have the Region set as us-central1 and the Zone as Any.
    4. Under Connectivity, tick Private IP.
    5. Enable Service Networking API.
    6. Under Associated networking, select the default Network.
    7. Choose to use an automatically allocated IP range.
    8. Untick Public IP to remove public IP connections from this instance.
    9. Change the machine type to Shared Core, 1 vCPU, 1.7 GB..
  2. Challenge

    Create a Custom Service Account

    1. Create a new service account named wordpress-app.
    2. 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.
  3. Challenge

    Create the WordPress Instance on Compute Engine

    1. Create a new instance named wordpress.
    2. Set the Region to us-central1 (the console will choose a zone for you).
    3. Change the Machine type to e2-small.
    4. Have the instance deploy a container to the VM instance, and use the container wordpress.
    5. For our service account, make sure to select wordpress-app.
    6. Allow all HTTP traffic on the instance.
    7. Use the VM's External IP link to see the WordPress language selection screen.
  4. Challenge

    Set Up WordPress and the Database

    Before we configure WordPress, we must first create the database inside our new Cloud SQL instance.

    1. Take note of the private IP for our wordpress-db instance.
    2. Create a new database with the name wordpress.

    Complete the rest of these steps in WordPress:

    1. Choose your preferred language, then on the next screen click Let's go!.
    2. 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_
    3. Run the installation.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans