Knowledge Catalog: Qwik Start - Console

Solution for Knowledge Catalog: Qwik Start - Console. 1 lab: GSP1143. Fast copy-paste commands for Google Cloud.

GSP1143 — Knowledge Catalog: Qwik Start - Console

Estimated time: 15 minutes

# 📚 Knowledge Catalog: Qwik Start - Console > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created to help you understand Google Cloud services and strengthen your practical cloud skills. It is intended for educational purposes, hands-on practice, and certification preparation only. We encourage you to attempt the lab on your own before using this guide. This walkthrough is **not affiliated with or endorsed by Google, Google Cloud, Google Cloud Skills Boost, or Qwiklab

#!/bin/bash
# ==============================================================================
# ORBIT OF OPS - PART 1: DATA MESH CREATION (GSP1143)
# ==============================================================================
GREEN='\e[1;32m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
MAGENTA='\e[1;35m'
WHITE='\e[1;37m'
RED='\e[1;31m'
RESET='\e[0m'
BOLD='\e[1m'

clear
echo -e "${CYAN}${BOLD}"
cat << "EOF"
  ____       _     _ _            __    ___            
 / __ \     | |   (_) |          / _|  / _ \           
| |  | |_ __| |__  _| |_   ___  | |_  | | | |_ __  ___ 
| |  | | '__| '_ \| | __| / _ \ |  _| | | | | '_ \/ __|
| |__| | |  | |_) | | |_ | (_) || |   | |_| | |_) \__ \
 \____/|_|  |_.__/|_|\__| \___/ |_|    \___/| .__/|___/
                                            | |        
                                            |_|        
EOF
echo -e "${RESET}"
echo -e "${BLUE}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${BLUE}${BOLD}║   🚀 PART 1: BUILD KNOWLEDGE CATALOG DATA MESH             ║${RESET}"
echo -e "${BLUE}${BOLD}║   🌐 BROUGHT TO YOU BY ORBIT OF OPS                        ║${RESET}"
echo -e "${BLUE}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}\n"

echo -e "${YELLOW}${BOLD}[Orbit of Ops] Auto-fetching Project and Region...${RESET}"
export PROJECT_ID=$(gcloud config get-value project 2>/dev/null)
if [[ -z "$PROJECT_ID" ]]; then
    export PROJECT_ID=$DEVSHELL_PROJECT_ID
fi

export ZONE=$(gcloud compute project-info describe \
    --format="value(commonInstanceMetadata.items[google-compute-default-zone])" 2>/dev/null | tail -n 1)

if [[ -z "$ZONE" ]]; then
    echo -e "${BOLD}${RED}⚠️ Could not auto-detect the default zone via gcloud metadata.${RESET}"
    read -p "Please enter the lab Zone (e.g., us-central1-a): " ZONE
    export ZONE
fi

export REGION=${ZONE%-*}
gcloud config set compute/region $REGION 2>/dev/null

echo -e "✅ Project ID: ${GREEN}$PROJECT_ID${RESET}"
echo -e "✅ Region:     ${GREEN}$REGION${RESET}\n"

echo -e "${BLUE}${BOLD}[Orbit of Ops] Enabling Dataplex API...${RESET}"
gcloud services enable dataplex.googleapis.com

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 1: Creating 'sensors' Lake (Handling lazy provisioning)...${RESET}"
CREATE_LAKE_CMD="gcloud dataplex lakes create sensors --location=$REGION --display-name=\"sensors\""
eval $CREATE_LAKE_CMD || { echo -e "${YELLOW}API sync delay detected. Waiting 45s and retrying...${RESET}"; sleep 45; eval $CREATE_LAKE_CMD; }

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 2: Adding 'temperature-raw-data' Zone to Lake...${RESET}"
gcloud dataplex zones create temperature-raw-data \
    --location=$REGION \
    --lake=sensors \
    --display-name="temperature raw data" \
    --resource-location-type=SINGLE_REGION \
    --type=RAW \
    --discovery-enabled \
    --discovery-schedule="0 * * * *"

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 3A: Creating Cloud Storage Bucket...${RESET}"
gsutil mb -l $REGION gs://$PROJECT_ID

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 3B: Attaching Bucket to Zone as an Asset...${RESET}"
gcloud dataplex assets create measurements \
    --location=$REGION \
    --lake=sensors \
    --zone=temperature-raw-data \
    --display-name="measurements" \
    --resource-type=STORAGE_BUCKET \
    --resource-name=projects/$PROJECT_ID/buckets/$PROJECT_ID \
    --discovery-enabled

echo -e "\n${MAGENTA}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${MAGENTA}${BOLD}║  🎉 PART 1 COMPLETE! VERIFY PROGRESS IN LAB MANUAL NOW! 🎉 ║${RESET}"
echo -e "${MAGENTA}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}"
echo -e "${WHITE}${BOLD}⚠️ DO NOT RUN PART 2 UNTIL YOU HAVE THE POINTS FOR TASKS 1, 2, AND 3!${RESET}"
#!/bin/bash
# ==============================================================================
# ORBIT OF OPS - PART 2: RESOURCE TEARDOWN (GSP1143)
# ==============================================================================
GREEN='\e[1;32m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
MAGENTA='\e[1;35m'
RESET='\e[0m'
BOLD='\e[1m'

echo -e "\n${CYAN}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${CYAN}${BOLD}║   🗑️  PART 2: DATA MESH TEARDOWN (TASK 4)                  ║${RESET}"
echo -e "${CYAN}${BOLD}║   🌐 BROUGHT TO YOU BY ORBIT OF OPS                        ║${RESET}"
echo -e "${CYAN}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}\n"

export REGION=${ZONE%-*}

echo -e "${BLUE}${BOLD}[Orbit of Ops] Detaching 'measurements' Asset...${RESET}"
gcloud dataplex assets delete measurements \
    --location=$REGION \
    --zone=temperature-raw-data \
    --lake=sensors \
    --quiet

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Deleting 'temperature-raw-data' Zone...${RESET}"
gcloud dataplex zones delete temperature-raw-data \
    --location=$REGION \
    --lake=sensors \
    --quiet

echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Deleting 'sensors' Lake...${RESET}"
gcloud dataplex lakes delete sensors \
    --location=$REGION \
    --quiet

echo -e "\n${MAGENTA}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${MAGENTA}${BOLD}║   🎉 ALL TASKS COMPLETE! VERIFY FINAL PROGRESS! 🎉         ║${RESET}"
echo -e "${MAGENTA}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}"