GCP
Google Cloud Platform — cloud infrastructure, compute, storage และ managed services
What I Can Do
- จัดการ cloud infrastructure บน GCP
- Deploy services บน Compute Engine และ Cloud Run
- ตั้งค่า networking (VPC, firewall rules, load balancing)
- ใช้ managed services (Cloud SQL, Pub/Sub, Cloud Storage)
- ตั้งค่า monitoring และ alerting ด้วย Cloud Monitoring
Commands I Use Daily
# login เข้า GCP
gcloud auth login
# set project
gcloud config set project my-project
# list instances
gcloud compute instances list
# SSH เข้า instance
gcloud compute ssh my-instance --zone=asia-southeast1-b
# deploy to Cloud Run
gcloud run deploy my-service --image gcr.io/my-project/my-app --region asia-southeast1
# ดู logs
gcloud logging read "resource.type=cloud_run_revision" --limit 50
# list services
gcloud run services list
# copy files ไป/มา Cloud Storage
gsutil cp local-file.txt gs://my-bucket/
gsutil cp gs://my-bucket/remote-file.txt ./Compute Engine
Compute Engine = virtual machines บน GCP — เลือก machine type (CPU, memory), boot disk, region/zone ใช้สำหรับ workloads ที่ต้องการ full control เช่น self-managed databases, custom services
Cloud Run
Cloud Run = serverless container platform — deploy Docker container แล้ว GCP จัดการ scaling อัตโนมัติ, scale to zero เมื่อไม่มี traffic, จ่ายตาม usage เหมาะสำหรับ APIs, web apps
Cloud Storage (GCS)
Object storage สำหรับ files — Buckets เก็บ objects, เลือก storage class (Standard, Nearline, Coldline, Archive) ตามความถี่ในการ access, ใช้ gsutil หรือ client libraries
VPC Networking
- VPC — Virtual Private Cloud, private network สำหรับ resources
- Subnets — แบ่ง IP ranges ตาม region
- Firewall rules — ควบคุม traffic เข้า-ออก
- Cloud NAT — ให้ private instances เข้า internet ได้
- Cloud Load Balancing — distribute traffic ข้าม instances
IAM (Identity & Access Management)
IAM ควบคุมว่าใครทำอะไรกับ resource ไหนได้ — roles (predefined/custom) assign ให้ members (users, service accounts, groups) principle of least privilege
Cloud SQL
Managed relational database — PostgreSQL, MySQL, SQL Server ไม่ต้อง manage patches, backups, replication เอง High availability ด้วย regional instances, automatic failover
Pub/Sub
Messaging service สำหรับ async communication — publish messages ไป topic, subscribers รับ messages ใช้สำหรับ event-driven architecture, decouple services
Cloud Build
CI/CD service — build, test, deploy อัตโนมัติ trigger จาก Git push, ใช้ cloudbuild.yaml define steps, integrate กับ Container Registry
Monitoring & Logging
- Cloud Monitoring — metrics, dashboards, alerting
- Cloud Logging — centralized log management, log-based metrics
- Error Reporting — auto-detect และ group errors
- Cloud Trace — distributed tracing สำหรับ latency analysis
Secret Manager
เก็บ sensitive data (API keys, passwords, certificates) อย่างปลอดภัย — versioned, access-controlled, audit logged ไม่เก็บ secrets ใน code หรือ environment variables โดยตรง