AI Skill Report Card
Managing Gcp Infrastructure
YAML--- name: managing-gcp-infrastructure description: Manages Google Cloud Platform infrastructure using gcloud CLI commands. Use when deploying resources, configuring services, or troubleshooting GCP environments. ---
Managing GCP Infrastructure
Quick Start
Bash# Set project and get cluster credentials gcloud config set project YOUR_PROJECT_ID gcloud container clusters get-credentials CLUSTER_NAME --zone ZONE # Deploy a basic web app gcloud run deploy my-app --image gcr.io/PROJECT/app:latest --platform managed --region us-central1
Recommendation▾
Expand Quick Start to show complete end-to-end example (auth setup through deployment verification) rather than just two commands
Workflow
Progress:
- Set up environment (
gcloud auth login, set project) - Plan resource architecture (compute, networking, storage)
- Create infrastructure with gcloud commands
- Configure networking and security
- Deploy applications
- Set up monitoring and logging
- Test and validate deployment
Core Commands Pattern:
- Authentication:
gcloud auth loginor service account key - Project context:
gcloud config set project PROJECT_ID - Resource creation: Use
gcloud [service] createcommands - Verification:
gcloud [service] describeorlist - Cleanup:
gcloud [service] deletewhen needed
Recommendation▾
Make examples more concrete by using realistic project/resource names instead of placeholders like 'YOUR_PROJECT_ID' and 'CLUSTER_NAME'
Examples
Example 1: GKE Cluster Setup Input: Need production-ready Kubernetes cluster Output:
Bashgcloud container clusters create prod-cluster \ --zone us-central1-a \ --machine-type e2-standard-4 \ --num-nodes 3 \ --enable-autoscaling \ --min-nodes 1 \ --max-nodes 10 \ --enable-autorepair \ --enable-autoupgrade
Example 2: Cloud SQL Database Input: PostgreSQL database for application Output:
Bashgcloud sql instances create mydb-instance \ --database-version POSTGRES_13 \ --tier db-f1-micro \ --region us-central1 \ --storage-auto-increase gcloud sql databases create myapp-db --instance mydb-instance
Example 3: Load Balancer with SSL Input: HTTPS load balancer for web application Output:
Bash# Create SSL certificate gcloud compute ssl-certificates create my-ssl-cert \ --domains example.com # Create load balancer gcloud compute url-maps create my-lb \ --default-service my-backend-service gcloud compute target-https-proxies create my-https-proxy \ --url-map my-lb \ --ssl-certificates my-ssl-cert gcloud compute forwarding-rules create my-https-rule \ --global \ --target-https-proxy my-https-proxy \ --ports 443
Recommendation▾
Add failure scenarios and troubleshooting commands to examples section (e.g., what to do when deployment fails, permission errors)
Best Practices
- Use service accounts: Create dedicated service accounts with minimal required permissions
- Enable APIs first:
gcloud services enable container.googleapis.combefore using services - Tag resources: Always add labels for cost tracking and organization
- Use configuration files: Store complex deployments in YAML/JSON for repeatability
- Set quotas: Monitor and set appropriate quotas to prevent cost overruns
- Regional redundancy: Deploy across multiple zones for high availability
- Backup strategy: Implement automated backups for databases and persistent volumes
Common Pitfalls
- Wrong project context: Always verify
gcloud config get-value projectbefore operations - Insufficient permissions: Use
gcloud auth listto check active account - Resource naming: GCP has strict naming conventions; use lowercase, hyphens only
- Firewall rules: Don't forget to open necessary ports with
gcloud compute firewall-rules - Billing alerts: Set up budget alerts to avoid surprise costs
- Default networks: Delete default VPC and create custom networks for production
- Service account keys: Avoid downloading JSON keys; use workload identity when possible
- Resource cleanup: Unused resources accumulate costs; regular cleanup is essential