Setting Up a Google Cloud Development Environment

Hands-On Lab

 

Photo of Joseph Lowery

Joseph Lowery

Google Cloud Training Architect II in Content

Length

00:15:00

Difficulty

Beginner

In this hands-on lab, you’ll create a Compute Engine virtual machine instance, set it up to run an Nginx web server, modify the home page, and then test your implementation.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Setting Up a Google Cloud Development Environment

In this hands-on lab, you’ll create a Compute Engine virtual machine instance, set it up to run an Nginx web server, modify the home page, and then test your implementation.

How to Log in to Google Lab Accounts

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

You're now logged in to the Google Cloud Platform console.

Setting Up a Development Environment

Now, on to the lab!

Choose a project.

  1. Choose Select a project from the top navigation.
  2. When the dialog opens, choose LINUXACADEMYGCLABS.COM as the organization, and then select the available project.

Create a Compute Engine VM.

  1. Navigate to Compute Engine > VM instances.
  2. On the VM instances page, click Create.
  3. With New VM instance chosen from the options on the left, configure your instance:
    • Provide a relevant Name using hyphens, like "la-pro-dev-1".
    • Keep the suggested Region and Zone.
    • Change the Machine Type to small.
    • In the Boot Disk section, click Change, select Ubuntu 18.10, and click Select.
    • In the Identity and API access section, under Access Scopes, choose Allow full access to all Cloud APIs.
    • Under Firewall, choose Allow HTTP traffic.
  4. Click Create.

Log in to an instance via SSH.

  1. After the VM has been created, a green check mark will appear next to the instance name on the Compute Engine VM page.
  2. Click the associated SSH button.

Install Nginx.

  1. In the SSH window that appears, change to the root user:

    sudo -i
  2. Set up Nginx:

    apt-get update
    apt-get install -y nginx
  3. Start up the service:

    service nginx start

Confirm Nginx is working.

  1. Return to the Compute Engine VM page of the Google Cloud console.
  2. Click the Extenal IP address associated with your VM instance.
  3. Confirm Nginx is running properly.

Modify the Nginx home page.

  1. Return to the SSH window.

  2. Change directories:

    cd /var/www/html
  3. Open the index page for editing:

    sudo nano index.nginx-debian.html
  4. Move your cursor below the h1 tag, and add the following code:

    <h2>Brought to you by Linux Academy!</h2>
  5. Press Ctrl+O to write out the file.

  6. Press Enter/Return to confirm.

  7. Press Ctrl+X to exit the editor.

  8. Enter exit to end the SSH session and close the window.

Confirm the update.

  1. From the Google Cloud VM page, click the External IP link.
  2. In the browser window, verify the revised page is visible.

Conclusion

Congratulations on completing this lab!