Lab Manual Cloudcomputing
Lab Manual Cloudcomputing
Lab Program 01
Title: Creating a Virtual Machine: Configure and deploy a virtual machine with specific CPU
and memory requirements in Google Cloud.
Problem Description:Need to create and deploy a virtual machine in Google Cloud with
specific CPU and memory requirements to run applications or services efficiently.
Method: Use Google Cloud Console or gcloud CLI to configure the VM by selecting
machine type, setting the number of vCPUs and RAM, choosing the desired OS image, and
launching the instance in the preferred region.
Creating a Virtual Machine: Configure and deploy a virtual machine with specific CPU
and memory requirements in Google Cloud.
OUTPUT
Cloud Computing BCS601 Lab Manual
Cloud Computing BCS601 Lab Manual
Lab Program 02
Title: Getting Started with Cloud Shell and gcloud: Discover the use of gcloud commands
to manage Google Cloud resources from Cloud Shell.
Problem Description: Creating and deploying a virtual machine (VM) on Google Cloud
involves configuring it with the necessary CPU, memory, and storage requirements. Google
Cloud’s Compute Engine service allows for custom configurations to meet specific
workload needs. Once deployed, the VM can be accessed remotely and managed through the
console.
Method:Start by setting up a Google Cloud account and enabling the Compute Engine API.
Configure the VM’s region, machine type, CPU, memory, and storage, then select the
operating system. Finally, review the configuration and create the VM, which can be
accessed and managed via SSH or RDP.
Getting Started with Cloud Shell and gcloud: Discover the use of gcloud commands to
manage Google Cloud resources from Cloud Shell.
Step 10: Enable an API (Example: Compute Engine API) To enable an API, such as the
Compute Engine API, run: gcloud services enable compute.googleapis.com
Cloud Computing BCS601 Lab Manual
Step 11: Deploy an Application to App Engine If you have an application ready, deploy
it using:
gcloud app deploy
Follow the instructions to deploy and access your app.
Step 12: View Active Billing Accounts Check your billing accounts using:
gcloud beta billing accounts list
OUTPUT
Cloud Computing BCS601 Lab Manual
Lab Program 03
Title:Cloud Functions: Create and deploy a Cloud Function to automate a specific task based
on a Cloud Storage.
Method: Set up Google Cloud account and enable Cloud Functions and Cloud Storage APIs.
Write the function to trigger on specific Cloud Storage events, like file uploads, and perform
the desired task. Deploy the function and test it by triggering the event, ensuring it runs
automatically.
Cloud Functions: Create and deploy a Cloud Function to automate a specific task based
on a Cloud Storage event.
Step 1: Enable Required APIs Before deploying the Cloud Function, enable the necessary
APIs: gcloud services enable cloudfunctions.googleapis.com storage.googleapis.com
Step 2: Create a Cloud Storage Bucket If you don't have a Cloud Storage bucket, create one:
gcloud storage buckets create BUCKET_NAME --location=us-central1
Replace BUCKET_NAME with a unique name for your bucket.
function.
2. Create and open a new Python file (main.py):
nano main.py
3. Add the following code inside main.py:
import functions_framework
@functions_framework.cloud_event
def gcs_trigger(cloud_event):
"""Triggered when a file is uploaded to Cloud Storage."""
data = cloud_event.data
bucket = data["bucket"]
file_name= data["name"]
print(f"J) File {file_name} uploaded to {bucket}")
4. Save and close the file (CTRL + X, Y, Enter).
Lab Program 04
Title: App Engine: Deploy a web application on App Engine with automatic scaling enabled.
Problem Description: App Engine lets you deploy web applications on Google Cloud with
automatic scaling, handling traffic fluctuations without manual intervention. The goal is to
host a web app that scales based on demand, ensuring efficient resource usage. This
eliminates the need for managing servers while providing a fully managed environment.
Method:Set up a Google Cloud account and enable the App Engine API. Develop your web
app, configure the app.yaml for automatic scaling, and deploy using the Cloud Console or
CLI. App Engine will automatically adjust resources based on traffic, maintaining optimal
performance.
App Engine: Deploy a web application on App Engine with automatic scaling enabled.
nano main.py
3. Add the following simple Flask application code:
from flask import Flask
app = Flask( name _)
@app.route('/')
def home():
return "Welcome to Google App Engine with Auto Scaling!"
if name == ' main ': app.run(host='0.0.0.0', port=8080)
4. Save and close (CTRL + X, Y, Enter).
OUTPUT
Cloud Computing BCS601 Lab Manual
Lab Program 05
Title: Cloud Storage: Qwikstart: Google Cloud Storage provides scalable and secure object
storage for managing data, accessible via the Cloud Console or gsutil CLI.
Problem Description: Google Cloud Storage provides scalable, secure object storage for
managing large amounts of data. It allows users to store and access data easily through the
Cloud Console or gsutil CLI. The service is designed for high availability and reliability.
Method:Set up a Google Cloud account and enable the Cloud Storage API. Create a bucket in
the Cloud Console or using gsutil, then upload and manage your data. You can access,
organize, and secure your data through the Cloud Console or gsutil CLI.
Cloud Storage: Qwikstart: Google Cloud Storage provides scalable and secure object
storage for managing data, accessible via the Cloud Console or gsutil CLI.
OUTPUT
Cloud Computing BCS601 Lab Manual
Cloud Computing BCS601 Lab Manual
Lab Program 06
Title: Cloud SQL for MySQL: Discover how Google Cloud SQL for MySQL provide
automated management and high availability for MySQL databases?
Problem Description: Google Cloud SQL for MySQL offers a fully managed database
service with automated backups, patching, and scaling. It provides high availability and
reliability, ensuring minimal downtime and data security for MySQL databases. This service
allows developers to focus on applications rather than database management tasks.
Method: Set up a Google Cloud account and enable the Cloud SQL API. Create a MySQL
instance through the Cloud Console, configuring settings like availability, backups, and
scaling. Cloud SQL handles maintenance tasks like updates and backups, ensuring your
database remains secure and highly available.
Cloud SQL for MySQL: Discover how Google Cloud SQL for MySQL provide
automated management and high availability for MySQL databases?
Using Django/Flask:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'your-db-name',
'USER': 'root',
'PASSWORD': 'your-password',
'HOST': '/cloudsql/your-project-id:your-region:your-instance',
'PORT': '3306',
}
}
OUTPUT
Lab Program 07
Title: Cloud Pub/Sub: Experiment how Google Cloud Pub/Sub facilitate real-time
messaging and communication between distributed applications.
Problem Description: Google Cloud Pub/Sub is a messaging service that enables real-time
communication between distributed applications. It allows messages to be sent
asynchronously between different systems, facilitating event-driven architectures. This
service helps in building scalable and decoupled systems with high availability.
Method: Set up a Google Cloud account and enable the Pub/Sub API. Create a topic and
subscription in the Cloud Console, then publish and subscribe to messages using the Pub/Sub
client libraries. Messages are automatically delivered to subscribers in real time, enabling
seamless communication between applications.
Cloud Pub/Sub: Experiment how Google Cloud Pub/Sub facilitate real- time messaging
and communication between distributed applications
Google Cloud Pub/Sub is a fully managed messaging service that enables asynchronous, real-
time communication between distributed applications. It follows a publish-subscribe model
where publishers send messages to topics and subscribers receive them via push or pull
delivery.
1. Open Google Cloud Console Navigation Menu () APIs & Services Library.
Lab Program 08
Title: Multiple VPC Networks: Explore benefits of using multiple VPC networks in Google
Cloud for organizing and isolating resources.
Problem Description: Using multiple VPC networks in Google Cloud helps organize and
isolate resources by separating them into different virtual networks. This approach enhances
security, as resources in different VPCs can have controlled communication. It also improves
network management and optimizes resource allocation across various projects or
environments.
Method: Set up a Google Cloud account and enable the VPC network API. Create multiple
VPC networks through the Cloud Console, each with specific subnets, firewall rules, and
routing configurations. Use VPC peering or shared VPC to manage communication between
networks while maintaining isolation and security.
Multiple VPC Networks: Explore benefits of using multiple VPC networks in Google
Cloud for organizing and isolating resources.
Google Cloud, Virtual Private Cloud (VPC) allows you to define and control networking
environments for your resources. You can have multiple VPC networks, each isolated from
one another or interconnected for specific use cases. Managing multiple VPCs helps you
scale, secure, and organize resources efficiently.
· Network Isolation – You can isolate resources within different VPC networks to
improve security and control traffic between services.
Cloud Computing BCS601 Lab Manual
· Private Connectivity – Each VPC can have private IPs that do not communicate
with other VPCs unless explicitly allowed, keeping sensitive data isolated.
· Granular Firewall Rules – Define specific firewall rules for each VPC, limiting
access to resources within a VPC or between multiple VPCs.
Traffic Control
VPC Peering – You can allow traffic between two or more VPCs by creating
VPC peering connections. This gives you flexibility in managing traffic flow
while maintaining network isolation.
· Shared VPC – A Shared VPC allows multiple projects to connect to a common
VPC network, enabling central management of network resources.
· Private Google Access – For certain services, you can configure access to Google
Cloud services without using public IPs, enhancing security.
Scaling Flexibility
● Multi-Tier Applications
You can deploy multi-tier architectures where each tier (e.g., web, app, database) resides in
separate VPC networks, enabling better isolation and security between tiers.
● Cross-Region Architecture
You can deploy resources in multiple regions for disaster recovery or to meet local
Cloud Computing BCS601 Lab Manual
compliance requirements while maintaining network isolation between regions. For instance,
a production VPC in one region and a disaster recovery VPC in another.
OUTPUT
Cloud Computing BCS601 Lab Manual
Cloud Computing BCS601 Lab Manual
Lab Program 09
Title: Cloud Monitoring: Discover how Cloud Monitoring help in tracking and analyzing the
performance and health of cloud resources?
Problem Description: Google Cloud Monitoring helps track and analyze the performance,
availability, and health of cloud resources in real time. It provides insights into the status of
applications, services, and infrastructure, enabling users to detect issues early and ensure
optimal performance. The service supports alerting, dashboards, and logging for effective
resource management.
Method:Set up a Google Cloud account and enable the Cloud Monitoring API. Create custom
dashboards to monitor resources and set up alerts for performance thresholds. Cloud
Monitoring continuously tracks the health of resources, sending notifications and insights to
ensure smooth operations and quick issue resolution.
Cloud Monitoring: Discover how Cloud Monitoring help in tracking and analyzing the
performance and health of cloud resources?
● Performance Tracking
Cloud Computing BCS601 Lab Manual
· Resource Metrics – Track metrics for Compute Engine, Kubernetes Engine, Cloud
Functions, Cloud SQL, and other services to assess resource usage (e.g., CPU,
memory, disk, network usage).
· Custom Metrics – You can define your own custom metrics for specific
applications to monitor application-level health or performance.
· Real-Time Metrics – Get near real-time data updates on how your infrastructure is
performing.
● Health Monitoring
· Health Checks – Cloud Monitoring can check the health of your Compute Engine
instances, App Engine, or any other services you configure, ensuring that everything is
running smoothly.
· Uptime Checks – Automate the monitoring of service availability across regions and
ensure that downtime is minimized.
OUTPUT
Cloud Computing BCS601 Lab Manual
Lab Program 10
Problem Description:Google Kubernetes Engine (GKE) allows you to deploy and manage
containerized applications on a fully managed Kubernetes cluster. It automates the
deployment, scaling, and management of containerized applications, ensuring high
availability and performance. With GKE, developers can focus on building applications while
Kubernetes handles the underlying infrastructure.
Method: Set up a Google Cloud account and enable the Kubernetes Engine API. Create a
Kubernetes cluster in the Cloud Console, then deploy your containerized application using
kubectl or the Cloud Console. GKE will manage the application’s scaling, networking, and
health, providing seamless deployment and management.
2. Install kubectl
● kubectl is the Kubernetes command-line tool used to manage Kubernetes
clusters. The Cloud SDK includes kubectl, so if you have the SDK installed, you
already have kubectl.
1. Create a new Google Cloud project (if you don't already have one):
o Go to the Google Cloud Console.
o Click on Select a Project > New Project.
o Name your project and click Create.
Dockerfile:
FROM node:14
WORKDIR /usr/src/app
COPY . .
RUN npm install
EXPOSE 8080
CMD [ "npm", "start" ]
deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: gcr.io/PROJECT_ID/my-app:v1
ports:
- containerPort: 8080
apiVersion: v1
kind:Service
metadata:
name: my-app-service spec:
selector:
app: my-app ports:
- protocol: TCP
port: 80
targetPort: 8080
Cloud Computing BCS601 Lab Manual
type: LoadBalancer
3. Get the external IP address: It may take a few moments or the LoadBalancer to be
provisioned.
kubectl get svc
The EXTERNAL-IP column will show the public IP once the LoadBalancer is provisioned.
OUTPUT
Cloud Computing BCS601 Lab Manual