1 of 31

BCS601 �Cloud Computing �(With integrated Lab)

2024-2025

2 of 31

Title and Content Layout with List

1

Creating a Virtual Machine: Configure and deploy a virtual machine with specific CPU and memory requirements in Google Cloud.

OR

Exploring AWS CloudShell and the AWS Cloud9 IDE

2

Getting Started with Cloud Shell and gcloud: Discover the use of gcloud commands to manage Google Cloud resources from Cloud Shell.

OR

Working with Amazon S3Orchestrating Serverless Functions with AWS Step Functions

3

Cloud Functions: Create and deploy a Cloud Function to automate a specific task based on a Cloud Storage event.

OR

Working with Amazon DynamoDB

4

App Engine: Deploy a web application on App Engine with automatic scaling enabled. OR

Developing REST APIs with Amazon API Gateway

3 of 31

5

Cloud Storage: Qwikstart: Google Cloud Storage provides scalable and secure object storage for managing data, accessible via the Cloud Console or gsutil CLI.

OR

Creating Lambda Functions Using the AWS SDK for Python

6

Cloud SQL for MySQL: Discover how Google Cloud SQL for MySQL provide automated management and high availability for MySQL databases?

OR

Migrating a Web Application to Docker Containers

7

Cloud Pub/Sub: Experiment how Google Cloud Pub/Sub facilitate real-time messaging and communication between distributed applications.

OR

Caching Application Data with ElastiCache, Caching with Amazon CloudFronT, Caching Strategies

8

Multiple VPC Networks: Explore benefits of using multiple VPC networks in Google Cloud for organizing and isolating resources.

OR

Implementing CloudFront for Caching and Application Security

9

Cloud Monitoring: Discover how Cloud Monitoring help in tracking and analyzing the performance and health of cloud resources?

OR

Orchestrating Serverless Functions with AWS Step Functions

10

Kubernetes Engine: Qwik Start: Deploy a containerized application to a Kubernetes Engine cluster.

OR

Automating Application Deployment Using a CI/CD Pipeline

4 of 31

Complex Experiments (Not for CIE)

  • Create and Manage Cloud Resources: Challenge Lab: In this lab, Students will use the Google Cloud Console and the gcloud command-line tool to create and manage various cloud resources. Start by provisioning virtual machines with specific configurations, such as CPU and memory requirements, and setting up storage
  • buckets for data persistence. Students also manage IAM roles to control access to these resources, ensuring that only authorized users can perform actions. The lab emphasizes the importance of understanding the relationships between different Google Cloud services and how to configure them to work together effectively. Successful completion requires a careful approach to resource management, including monitoring, security settings, and cost optimization.
  • Set Up an App Dev Environment on Google Cloud: Challenge Lab: This lab focuses
  • on setting up a complete development environment on Google Cloud, starting with configuring Cloud Shell and installing the necessary development tools. Students work with Cloud SDK and other programming languages or frameworks required for
  • your application. After setting up the environment, Deploy a sample application to test the configuration and ensure that the environment is fully functional. This lab highlights the importance of creating a robust and scalable environment that can support continuous development and deployment processes. Additionally, you must ensure that the environment is optimized for performance and ready to handle real-world application
  • development and testing on Google Cloud.

5 of 31

Cloud Shell

  • Cloud Shell is an interactive shell environment for Google Cloud 
  • manage your projects and resources from your web browser.
  • the Google Cloud CLI and other utilities you need are pre-installed, fully authenticated, up-to-date, and always available
  • Cloud Shell comes with a built-in code editor with an integrated Cloud Code experience

Lab 2 : Getting Started with Cloud Shell and gcloud: Discover the use of gcloud commands to manage Google Cloud resources from Cloud Shell.

6 of 31

How cloud shell works?

  • Cloud Shell provisions a Compute Engine virtual machine running a Debian-based Linux operating system for your temporary use.
  • This virtual machine is owned and managed by Google Cloud, so will not appear within any of your Google Cloud projects.
  • Cloud Shell instances are provisioned on a per-user, per-session basis.
  • The instance persists while your Cloud Shell session is active; after an hour of inactivity, your session terminates and its VM is discarded.
  • Cloud Shell provisions 5 GB of free persistent disk storage mounted as your $HOME directory on the virtual machine instance.
  • This storage is on a per-user basis and is available across projects. 

7 of 31

Authorizing with Cloud Shell

  • When you make a Google Cloud API call or use a command-line tool that requires credentials (such as the Google Cloud CLI) with Cloud Shell for the first time, Cloud Shell prompts you to authorize. Click Authorize to allow the tool to use your credentials to make calls.

  • When Cloud Shell is started, the active project in the Google Cloud console is propagated to your gcloud configuration inside Cloud Shell for immediate use. GOOGLE_CLOUD_PROJECT, the environmental variable used by Application Default
  • WEB_HOST points to the hostname of your Cloud Shell VM which you can use to make HTTPS requests to the environment

Pre-configured environment variables

8 of 31

Available Tools

Type

Tool

Linux shell interpreters

bash�sh

Linux utilities

Standard Debian system utilities

gcloud CLI and tools

App Engine SDKGoogle Cloud CLI including the gcloud CLI�gsutil for Cloud Storage

Text editors

Emacs�Vim�Nano

Build and package tools

Gradle�Helm�Make�Maven�Bazel�npm�nvm�pip�Composer

Source control tools

Git�Mercurial�

Additional tools

Docker�iPython�MySQL client�gRPC compiler�TensorFlow�Terraform

Language

Version

Java

JRE/JDK 17 (OpenJDK)

Go

Latest

Python

3.12

Node.js

LTS

Ruby

3.2

PHP

8.3

.NET Core

SDKs 6.0, 7.0, and 8.0

9 of 31

Activate Cloud Shell

1. Answer the following questions about Google Cloud

  • How many regions?
  • How many zones?
  • How many network edge locations?
  • How many countries/territories?
  • Where is it located in india?

10 of 31

Ephemeral Mode

  • If you do not need persistent storage, use Cloud Shell in ephemeral mode. In ephemeral mode, you can get started with Cloud Shell faster because there is less set up and there is no disk attachment or archive. However, this means that all the files you create during your ephemeral mode session are deleted with the VM when the session ends.

  • To choose ephemeral mode, append ephemeral=true to the https://shell.cloud.google.com URL. For example: https://shell.cloud.google.com/?ephemeral=true.

11 of 31

Adjust the display window

12 of 31

Authorize

13 of 31

Set/List project

preethisheba_h@cloudshell:~$ gcloud config list project

[core]

project (unset)

Your active configuration is: [cloudshell-25811]

preethisheba_h@cloudshell:~$ $HOME

-bash: /home/preethisheba_h: Is a directory

preethisheba_h@cloudshell:~$ gcloud config set project light-depot-450506-c6

Updated property [core/project].

preethisheba_h@cloudshell:~ (light-depot-450506-c6)$ gcloud config list project

[core]

project = light-depot-450506-c6

Your active configuration is: [cloudshell-25811]

preethisheba_h@cloudshell:~ (light-depot-450506-c6)$

14 of 31

Getting Help

15 of 31

Using gcloud commands

preethisheba_h@cloudshell:~ (light-depot-450506-c6)$ gcloud config list

[accessibility]

screen_reader = True

[component_manager]

disable_update_check = True

[compute]

gce_metadata_read_timeout_sec = 30

[core]

account = preethisheba.h@cmrit.ac.in

disable_usage_reporting = False

project = light-depot-450506-c6

[metrics]

environment = devshell

Your active configuration is: [cloudshell-25811]

16 of 31

Create a Compute Engine from gshell

  • Compute Engine lets you create and run instances on Google infrastructure. This document explains how to create a Compute Engine instance.
  • The terms Compute Engine instance, compute instance or instance are synonymous.
  • Based on the machine type that you specify, an instance can be either a bare metal instance or a virtual machine (VM) instance, as follows:
  • If the name of its machine type ends in -metal, an instance is a bare metal instance, which does not have a hypervisor installed.
  • Otherwise, an instance is a VM instance. The terms virtual machine instance, VM instance, and VM are synonymous.

17 of 31

preethisheba_h@cloudshell:~ (light-depot-450506-c6)$ gcloud init

Welcome! This command will take you through the configuration of gcloud.

Pick configuration to use:

[1] Re-initialize this configuration [cloudshell-25811] with new settings

[2] Create a new configuration

Please enter your numeric choice: 1

Your current configuration has been set to: [cloudshell-25811]

Checking network connection...done.

Reachability Check passed.

Network diagnostic passed (1/1 checks passed).

---

Select an account:

[1] preethisheba.h@cmrit.ac.in

[2] Sign in with a new Google Account

[3] Skip this step

Please enter your numeric choice: 1

You are signed in as: [preethisheba.h@cmrit.ac.in].

Pick cloud project to use:

[1] light-depot-450506-c6

[2] Enter a project ID

[3] Create a new project

Please enter numeric choice or text value (must exactly match list item): 1

Your current project has been set to: [light-depot-450506-c6].

Do you want to configure a default Compute Region and Zone? (Y/n)? Y

Which Google Compute Engine zone would you like to use as project default?

If you do not specify a zone via a command line flag while working with Compute Engine resources,

the default is assumed.

[7] us-central1-c

[8] us-central1-a

[13] us-west1-a

Please enter numeric choice or text value (must exactly match list item): 7

18 of 31

Gcloud compute instances create

  • To create an instance with your own configuration, use the gcloud compute instances create command.
  • You can't use this command to create instances in bulk or instances that run container images. Instead, do the following:
  • To create instances in bulk, use the gcloud compute instances bulk create command.
  • To create instances to deploy containers, use the gcloud compute instances create-with-container command.

19 of 31

Machine family

  • General-purpose —best price-performance ratio for a variety of workloads.
  • Storage-optimized —best for workloads that are low in core usage and high in storage density.
  • Compute-optimized —highest performance per core on Compute Engine and optimized for compute-intensive workloads.
  • Memory-optimized —ideal for memory-intensive workloads, offering more memory per core than other machine families, with up to 12 TB of memory.
  • Accelerator-optimized —ideal for massively parallelized Compute Unified Device Architecture (CUDA) compute workloads, such as machine learning (ML) and high performance computing (HPC). This family is the best option for workloads that require GPUs.

20 of 31

Machine family, series, type

  • Machine family: A curated set of processor and hardware configurations optimized for specific workloads.
  • Machine series: Machine families are further classified by series, generation, and processor type.
    • Each series focuses on a different aspect of computing power or performance. For example, the E series offers efficient VMs at a low cost, while the C series offer better performance.
    • The generation is denoted by an ascending number. For example, the N1 series within the general-purpose machine family is the older version of the N2 series.
    • A higher generation or series number usually indicates newer underlying CPU platforms or technologies. 
  • Machine type: Every machine series offers at least one machine type. Each machine type provides a set of resources for your compute instance, such as vCPUS, memory, disks, and GPUs.

21 of 31

Predefined machine types�

  • Predefined machine types come with a non-configurable amount of memory and vCPUs. Predefined machine types use a variety of vCPU to memory ratios:

  • highcpu — from 1 to 3 GB memory per vCPU; typically, 2 GB memory per vCPU.
  • standard — from 3 to 7 GB memory per vCPU; typically, 4 GB memory per vCPU.
  • highmem — from 7 to 14 GB memory per vCPU; typically, 8 GB memory per vCPU.
  • megamem — from 14 to 19 GB memory per vCPU
  • hypermem — from 19 to 24 GB memory per vCPU; typically, 21 GB memory per vCPU
  • ultramem — from 24 to 31 GB memory per vCPU

  • Local SSD machine types are a special predefined machine type. The machine type name ends in -lssd.
  • Bare metal machine types are a special predefined machine type. The machine type name ends in -metal

22 of 31

Shared-core machine types�

  • The E2 and N1 series contain shared-core machine types. These machine types timeshare a physical core which can be a cost-effective method for running small, non-resource intensive apps.

  • E2: offers 2 vCPUs for short periods of bursting.

  • N1: offers f1-micro and g1-small shared-core machine types which have up to 1 vCPU available for short periods of bursting.

23 of 31

Machine family and series recommendations

General-purpose workloads

N4, N2, N2D, N1

C4A, C4, C3, C3D

E2

Tau T2D, Tau T2A

Balanced price/performance across a wide range of machine types

Consistently high performance for a variety of workloads

Day-to-day computing at a lower cost

Best per-core performance/cost for scale-out workloads

Medium traffic web and app servers

Containerized microservices

Business intelligence apps

Virtual desktops

CRM applications

Development and test environments

Batch processing

Storage and archive

High traffic web and app servers

DatabasesIn-memory caches

Ad servers

Game Servers

Data analytics

Media streaming and transcoding

CPU-based ML training and inference

Low-traffic web servers

Back office apps

Containerized microservices

Microservices

Virtual desktops

Development and test environments

Scale-out workloads

Web serving

Containerized microservices

Media transcoding

Large-scale Java applications

24 of 31

Gcloud compute instances create

25 of 31

E2 shared-core

26 of 31

Create VM using gcloud CLI

preethisheba_h@cloudshell:~ (light-depot-450506-c6)$ gcloud compute instances create my-vm \

--machine-type=e2-micro

NAME: my-vm

ZONE: us-central1-c

MACHINE_TYPE: e2-micro

PREEMPTIBLE:

INTERNAL_IP: 10.128.0.5

EXTERNAL_IP: 34.66.137.168

27 of 31

Starting and stopping your instance

28 of 31

View VM details and status

$ gcloud compute instances list

NAME: my-vm

ZONE: us-central1-c

MACHINE_TYPE: e2-micro

PREEMPTIBLE:

INTERNAL_IP: 10.128.0.5

EXTERNAL_IP: 34.66.137.168

STATUS: RUNNING

$gcloud compute instances describe my-vm

canIpForward: false

cpuPlatform: Intel Broadwell

creationTimestamp: '2025-02-15T04:35:10.002-08:00'

deletionProtection: false

disks:

- architecture: X86_64

autoDelete: true

boot: true

deviceName: persistent-disk-0

diskSizeGb: '10'

29 of 31

Connect to a VM

gcloud compute ssh my-vm

Updating project ssh metadata...working.Updated

Updating project ssh metadata...done.

Waiting for SSH key to propagate.

Warning: Permanently added 'compute.1285378715733014290' (ED25519) to the list of known hosts.

Linux my-vm 6.1.0-29-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.123-1 (2025-01-02) x86_64

The programs included with the Debian GNU/Linux system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent

permitted by applicable law.

preethisheba_h@my-vm:~$ whoami

preethisheba_h

preethisheba_h@my-vm:~$ lscpu

  • Compute Engine sets a username and creates a persistent SSH key pair with the following configurations:

  • Your username is the username set by your organization's Cloud Identity or Google Workspace administrator.

  • your public SSH key is stored in your Google Account.
  • Your private SSH key is stored on your local machine in the google_compute_engine file.
  • ~/.ssh/authorized_keys

30 of 31

Shutdown a VM

  • Exit the shell
  • Check all the resources are removed

preethisheba_h@my-vm:$ exit

logout

Connection to 34.66.137.168 closed.

gcloud beta compute instances stop my-vm --discard-local-ssd=true

31 of 31

Viva

  1. us-east1-a What is the region? What is the Zone?
  2. What is the gcloud CLI command to list the name of the active account?
  3. What is the size of persistent disk storage provisioned with cloud shell?
  4. List around 5 general purpose workloads and the series of machines most suitable, eg. e2 – Low traffic web servers