In this video, I walk through my Week 2 assignment for the
"Intro to Big Data" course — where the task is to find the
longest line(s) in a text file stored in Google Cloud Storage
(GCS), using a Python script running entirely on a GCP Virtual
Machine (Compute Engine). No local machine involved!
What makes this video real and useful: I ran into THREE actual
errors during the demo and solved every single one of them
live — so if you're stuck on a similar GCP project, this
video will save you hours.
TIMESTAMPS
0:00 - Introduction & Problem Statement
(What the assignment asks + my approach)
1:00 - GCP Setup — Creating a Cloud Storage Bucket
(Naming bucket using Project ID, Asia multi-region)
2:20 - Uploading Input File to GCS Bucket
2:43 - Creating a Compute Engine VM
(e2-micro, Mumbai region / asia-south1)
3:04 - Explaining the Input Text File
3:45 - Python Code Walkthrough
(Libraries, config, download/process/upload logic,
stripping \n, finding longest line, logging)
6:54 - SSH into VM + Running the Script (First Attempt)
8:12 - Error 1: ModuleNotFoundError (google.cloud)
Fix: Create Python virtual environment +
pip install google-cloud-storage
10:06 - Error 2: 403 Forbidden (Access Denied to Bucket)
Fix: Grant Storage Object Admin role to
VM's service account via IAM
13:01 - Error 3: Access Scope Error
Fix: Stop VM, Edit, Allow Full Access
to All Cloud APIs, Restart VM
20:33 - Script Runs Successfully
(Download, Find Longest Line, Upload output.txt)
21:09 - Verifying Output File in GCS Bucket
(Line 3 is the longest line)
22:22 - Learnings from this Assignment
GCP Services Used:
Google Cloud Storage (GCS) — Bucket and Blob management
Compute Engine — e2-micro VM (Mumbai / asia-south1)
IAM — Service Account permissions
Python 3 — google-cloud-storage library
Virtual Environment (venv)
3 Real Errors You Will Learn to Fix:
ModuleNotFoundError: No module named google.cloud
403 Forbidden: Bucket access denied from VM
Access Scope disabled on VM (how to fix via Stop, Edit, Start)
Perfect for:
Students doing GCP or Big Data course assignments
Cloud beginners running Python on Compute Engine
Anyone stuck on 403 or scope errors in GCP
What the Script Does:
1. Downloads a .txt file from a GCS bucket to the VM
2. Reads all lines and strips newline characters
3. Finds the line(s) with the maximum character length
4. Saves results to output.txt
5. Uploads output.txt back to GCS bucket
Like and Subscribe for more hands-on cloud computing content!
#bigdata #iam #gcp #googlecloudplatform #cloudcomputing #python #GoogleCloudStorage
#ComputeEngine #CloudStoragePython #GCSPython #CloudAssignment #GCPTutorial