Arcade Adventure: Modern Cloud Architecture
Solution for Arcade Adventure: Modern Cloud Architecture. 1 lab: GSP064. Fast copy-paste commands for Google Cloud.
GSP064 — Cloud IAM: Qwik Start
Estimated time: 15 minutes
# 🚀 Cloud IAM: Qwik Start > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created for educational purposes, hands-on practice, and Google Cloud certification preparation. This guide is designed to help learners understand Google Cloud IAM and complete practical exercises. Always attempt the lab yourself first and follow Google Cloud Skills Boost / Qwiklabs Terms of Service. This walkthrough is not affiliated with or endorsed by Google, Google Cloud, or Qwiklabs. Never s
clear
CYAN='\033[1;36m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
RESET='\033[0m'
BOLD='\033[1m'
echo -e "${CYAN}${BOLD}"
echo " ____ _ _ _ __ ___ "
echo " / __ \ | | (_) | / _| / _ \ "
echo " | | | |_ __| |__ _| |_ ___ | |_ | | | |_ __ ___ "
echo " | | | | '__| '_ \| | __| / _ \ | _|| | | | '_ \ / __| "
echo " | |__| | | | |_) | | |_ | (_) || | | |_| | |_) \__ \ "
echo " \____/|_| |_.__/|_|\__| \___/ |_| \___/| .__/|___/ "
echo " | | "
echo " |_| "
echo -e "${RESET}"
export PROJECT_ID=$(gcloud config get-value project)
export USER_1=$(gcloud config get-value account)
echo -e "${BLUE}▶ Dynamically detecting Username 2 from IAM policy...${RESET}"
export USER_2=$(gcloud projects get-iam-policy $PROJECT_ID --format="json" | jq -r '.bindings[] | select(.role == "roles/viewer") | .members[]' | grep "user:" | sed 's/user://' | grep -v $USER_1 | head -n 1)
if [[ -z "$USER_2" ]]; then
echo -e "${YELLOW}Could not detect Username 2 automatically. Please enter it manually:${RESET}"
read -p "Username 2: " USER_2
else
echo -e "${GREEN}✓ Target isolated: $USER_2${RESET}"
fi
echo -e "${YELLOW}▶ Creating Cloud Storage bucket...${RESET}"
gcloud storage buckets create gs://$PROJECT_ID --location=us > /dev/null 2>&1 || true
echo -e "${YELLOW}▶ Creating and uploading sample.txt...${RESET}"
echo "Awesome Lab Solution" > sample.txt
gcloud storage cp sample.txt gs://$PROJECT_ID/
echo -e "${BLUE}▶ Removing Project Viewer role (Bypassing condition prompts)...${RESET}"
gcloud projects remove-iam-policy-binding $PROJECT_ID \
--member=user:$USER_2 \
--role=roles/viewer \
--all --quiet
echo -e "${BLUE}▶ Granting Storage Object Viewer role (Bypassing condition prompts)...${RESET}"
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member=user:$USER_2 \
--role=roles/storage.objectViewer \
--condition=None --quiet
echo -e "${GREEN}✓ Lab completed seamlessly! You may now click Check my progress.${RESET}"