Create a Secure Data Lake on Cloud Storage

Solution for Create a Secure Data Lake on Cloud Storage. 1 lab: ARC119. Fast copy-paste commands for Google Cloud.

ARC119 — Create a Secure Data Lake on Cloud Storage: Challenge Lab

Estimated time: 20 minutes

# Knowledge Catalog Challenge Lab Follow the execution sequence below exactly as shown to successfully complete all tasks. ## 🚀 Step-by-Step Execution (Recommended) --- ## 🔹 Step 1 — Create the Storage Bucket (User 1) 1. Open an **Incognito** browser window. 2. Sign in to the **Google Cloud Console** using **User 1** credentials provided in your Google Cloud Skills Boost (Qwiklabs) lab. 3. Open **Google Cloud Shell**. 4. Copy and paste **Command (1 of 2)** into the terminal. 5. Press **En

GREEN='\e[1;32m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
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: ARC119 TERMINAL AUTOMATION INITIALIZED <<<${RESET}\n"

export PROJECT_ID=$(gcloud config get-value project 2>/dev/null)
echo -e "${YELLOW}${BOLD}[*] Project ID: ${PROJECT_ID}${RESET}"

# ==============================================================================
# Smart Region Auto-Fetch Logic
# ==============================================================================
echo -e "${CYAN}${BOLD}[*] Auto-fetching assigned Lab Region...${RESET}"
export REGION=$(gcloud compute project-info describe --format="value(commonInstanceMetadata.items[google-compute-default-region])" 2>/dev/null)

if [ -z "$REGION" ]; then
    export REGION=$(gcloud config get-value compute/region 2>/dev/null)
fi

if [ -z "$REGION" ]; then
    export ZONE=$(gcloud compute project-info describe --format="value(commonInstanceMetadata.items[google-compute-default-zone])" 2>/dev/null)
    if [ -z "$ZONE" ]; then
        export ZONE=$(gcloud config get-value compute/zone 2>/dev/null)
    fi
    export REGION="${ZONE%-*}"
fi

if [ -z "$REGION" ]; then
    echo -e "\n${RED}${BOLD}[!] Auto-fetch blocked by Qwiklabs. Please manually copy your assigned Region from the lab instructions.${RESET}"
    read -p "Enter Region (e.g., europe-west4): " REGION
else
    echo -e "${GREEN}${BOLD}[*] Region successfully identified: ${REGION}${RESET}\n"
fi

# ==============================================================================
# Execution Steps
# ==============================================================================
echo -e "${BLUE}${BOLD}[Orbit of Ops] Step 1: Enabling Required APIs...${RESET}"
gcloud services enable datacatalog.googleapis.com dataplex.googleapis.com storage.googleapis.com --quiet

echo -e "${CYAN}${BOLD}[Orbit of Ops] Step 2: Creating Cloud Storage Bucket in ${REGION}...${RESET}"
gsutil mb -l $REGION gs://$PROJECT_ID-bucket 2>/dev/null || true

echo -e "\n${GREEN}${BOLD}>>> CLOUD SHELL SETUP COMPLETE! Please follow the Knowledge Catalog UI steps to complete Tasks 2, 3, and 4. <<<${RESET}"