Perform Foundational Infrastructure Tasks in Google Cloud: Challenge Lab Tutorial

Detailed walk-through of the Perform Foundational Infrastructure Tasks in Google Cloud Skill Badge on Google Cloud Platform.

Ajil T U
4 min readSep 9, 2020

This medium article focuses on the detailed walk through of the steps I took to solve the challenge lab of the Perform Foundational Infrastructure Tasks in Google Cloud Skill Badge on the Google Cloud Platform.

This lab is only recommended for students who have completed the quest Baseline: Infrastructure on Qwiklabs.

Challenge scenario

You are just starting your junior cloud engineer role with Jooli inc. So far you have been helping teams create and manage Google Cloud Platform resources.

You are expected to have the skills and knowledge for these tasks so don’t expect step-by-step guides.

Your challenge

You are now asked to help a newly formed development team with some of their initial work on a new project around storing and organizing photographs, called memories. You have been asked to assist the memories team with initial configuration for their application development environment; you receive the following request to complete the following tasks:

  • Create a bucket for storing the photographs.
  • Create a Pub/Sub topic that will be used by a Cloud Function you create.
  • Create a Cloud Function.
  • Remove the previous cloud engineer’s access from the memories project.

Some Jooli Inc. standards you should follow:

  • Create all resources in the us-east1 region and us-east1-b zone, unless otherwise directed.
  • Use the project VPCs.
  • Naming is normally team-resource, e.g. an instance could be named kraken-webserver1
  • Allocate cost effective resource sizes. Projects are monitored and excessive resource use will result in the containing project’s termination (and possibly yours), so beware. This is the guidance the monitoring team is willing to share; unless directed, use f1-micro for small Linux VMs and n1-standard-1 for Windows or other applications such as Kubernetes nodes.

Task 1: Create a bucket

Activate Cloud Shell

In the Cloud Console, in the top right toolbar, click the Activate Cloud Shell button.

Click Continue.

gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.

You can list the active account name with this command:

gcloud auth list

You can list the project ID with this command:

gcloud config list project

Create a bucket

Run the gsutil mb command and replace with a unique name to create a bucket:

gsutil mb gs://<YOUR-BUCKET-NAME>

Tip : Use your project ID here as bucket name(Only while doing labs).

Click Check my progress to verify your performed task.

Task 2: Create a Pub/Sub topic

Google Cloud Pub/Sub is a messaging service for exchanging event data among applications and services. By decoupling senders and receivers, it allows for secure and highly available communication between independently written applications. Google Cloud Pub/Sub delivers low-latency/durable messaging, and is commonly used by developers in implementing asynchronous workflows, distributing event notifications, and streaming data from various processes or devices.

Run the following command to create a topic called myTopic:

gcloud pubsub topics create myTopic

Click Check my progress to verify your performed task.

Task 3: Create the thumbnail Cloud Function

Create a function

In this step, you’re going to create a cloud function using the console.

  1. In the console, click the Navigation menu > Cloud Functions.

2. Click Create function.

3. In the Create function dialog, enter the following values:

Name : GCFunction

Trigger Type : Cloud Storage

Event Type : Finalize/Create

Browse the bucket you have created and click Save.

Click Save

click Next

Set Runtime as Node.js 10

Entry point : thumbnail

Then, from lab instructions, replace code for index.js and package.json

On line 15 of index.js replace the text REPLACE_WITH_YOUR_TOPIC with the topic you created in task 2.

Then, click Deploy

After creating the function, upload an image in a bucket. You will see a thumbnail image appear shortly afterward (use REFRESH BUCKET).

Task 4: Remove the previous cloud engineer

  1. Go to IAM & Admin -> IAM

2. Search for Username 2

3. Remove it.

Click Check my progress to verify your performed task.

Build Interactive Apps with Google Assistant: Challenge Lab

Integrate with Machine Learning APIs: Challenge Lab Tutorial

--

--