Perform Foundational Infrastructure Tasks in Google Cloud: Challenge Lab

In this article, we will go through the lab to Perform Foundational Infrastructure Tasks in Google Cloud. In the previous, lab you will get familiar with Google Cloud Storage, Cloud IAM, Cloud Monitoring, Cloud Function and Cloud Pub/Sub.

The challenge contains 4 required tasks

  1. Create a bucket.
  2. Create a Pub/Sub topic.
  3. Create the Cloud Function.
  4. Remove the previous cloud engineer.

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.
Image for post
Image for post

1.Create a bucket

The first step is to create a Bucket(Storage)

  • In the GCP Console go to Navigation Menu >Storage>Browser> Create Bucket.
  • Click Create a bucket.
Image for post
Image for post

2.Create a Pub/Sub topic

In this step, you have to create a Pub/Sub topic for the Cloud Function to send messages.

  • In the GCP Console go to Navigation Menu >Pub/Sub > Topics.
Image for post
Image for post
  • Click Create a topic.

Note: Make sure you remember the topic name, which will be used in Task 3.

3.Create the Cloud Function

In this step, you have to create Cloud Function.

  • In the GCP Console go to Navigation Menu> Cloud Functions.
  • Click Create function.
  • In the Create function dialog, enter the following values:
Name: GCFunctionTrigger Type: Cloud StorageEvent Type: Finalize/Create 
  • Browse the bucket you have created and click Save.
  • Set Runtime as Node.js 10
Entry point : thumbnail 
  • Then you have to replace the code for index.js and package.json.
  • 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.
  • Click Deploy
Image for post
Image for post
  • Upload a JPG or PNG image file to the bucket created in Task 1.

You will verify the thumbnail was created. Use any JPG or PNG image, or use this image https://storage.googleapis.com/cloud-training/gsp315/map.jpg; download the image to your machine and then upload that file to your bucket. You will see a thumbnail image appear shortly afterwards (use REFRESH BUCKET).

4. Remove the previous cloud engineer

In this step, you have to Remove the previous cloud engineer.

  • In the GCP Console go to Navigation Menu> IAM.
Image for post
Image for post
  • Search for the second user.
  • Click the pencil icon, select Delete.

Congratulations! Done with the challenge lab.

Stay tuned till the next blog

If you Want to Connect with Me:

Linkedin: https://www.linkedin.com/in/mayank-chourasia-38421a134/

Twitter: https://twitter.com/ChourasiaMayank.

Google Developers Google Cloud Qwiklabs GoogleCloud Platform

Written by

I am Google Cloud Certified Associate Cloud Engineer and MS Azure Certifed. I have been working on different fields including Data Science, DevOps and Anthos.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store