Pub/Sub: Qwik Start - Console

Solution for Pub/Sub: Qwik Start - Console. 1 lab: GSP096. Fast copy-paste commands for Google Cloud.

GSP096 — Pub/Sub: Qwik Start - Console

Estimated time: 10 minutes

# 📬 Google Cloud Pub/Sub: Qwik Start - Console > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created to help you understand why each step works. Attempt the lab yourself first. This guide is intended for educational purposes and hands-on learning with Google Cloud services. It is not intended to replace the official lab instructions or your own understanding of the concepts. This walkthrough is not affiliated with or endorsed by Google Cloud or Google Cloud Skills Boo

# ==============================================================================
# Color Variables & Branding
# ==============================================================================
GREEN='\e[1;32m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
MAGENTA='\e[1;35m'
RED='\e[1;31m'
RESET='\e[0m'
BOLD='\e[1m'

clear
echo -e "${CYAN}${BOLD}"
cat << "EOF"
  ____       _     _ _            __    ___            
 / __ \     | |   (_) |          / _|  / _ \           
| |  | |_ __| |__  _| |_   ___  | |_  | | | |_ __  ___ 
| |  | | '__| '_ \| | __| / _ \ |  _| | | | | '_ \/ __|
| |__| | |  | |_) | | |_ | (_) || |   | |_| | |_) \__ \
 \____/|_|  |_.__/|_|\__| \___/ |_|    \___/| .__/|___/
                                            | |        
                                            |_|        
EOF
echo -e "${RESET}"
echo -e "${MAGENTA}${BOLD}>>> ORBIT OF OPS: GSP096 PART 1 INITIALIZED <<<${RESET}\n"

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

echo -e "${CYAN}${BOLD}[Orbit of Ops] Task 1: Creating Pub/Sub Topic (MyTopic)...${RESET}"
gcloud pubsub topics create MyTopic || true

echo -e "\n${GREEN}${BOLD}✅ Part 1 Complete. Check Task 1 progress in the lab window!${RESET}"
echo -e "\n${MAGENTA}${BOLD}>>> ORBIT OF OPS: GSP096 PART 2 INITIALIZED <<<${RESET}\n"

echo -e "${CYAN}${BOLD}[Orbit of Ops] Task 2: Creating Pub/Sub Subscription (MySub)...${RESET}"
# By default, gcloud creates a pull subscription unless --push-endpoint is specified.
gcloud pubsub subscriptions create MySub --topic=MyTopic || true

echo -e "\n${GREEN}${BOLD}🎉 All blocks executed successfully! Check Task 2 progress in the lab window!${RESET}"