← Cloud · GCP← Cloud · GCP
Cloud · GCPCloud · GCP19 Th7, 2026Jul 19, 202612 phút đọc11 min read

Tổng quan & Khái niệm cốt lõiOverview & Core Concepts

Thuộc bộ tài liệu Cloud knowledge base — GCP deep dive. Bổ sung cho DevOps Roadmap.

Tổng quan

Google Cloud Platform (GCP) là public cloud của Google, chạy trên chính hạ tầng đứng sau Google Search, Gmail, YouTube và Maps. Với một DevOps engineer đến từ AWS hay Azure, hai thay đổi tư duy lớn nhất là: GCP xem nhiều dịch vụ cốt lõi là global thay vì regional, và mọi thứ bạn tạo ra đều nằm trong một resource hierarchy (phân cấp tài nguyên) nghiêm ngặt (Organization → Folders → Projects → resources) — điểm neo duy nhất cho IAM, billing và policy.

Trang này là tấm bản đồ toàn cảnh: mạng vật lý của Google được bố trí thế nào, phân cấp logic hoạt động ra sao, bạn trả tiền kiểu gì, truy cập bằng cách nào, và ranh giới trách nhiệm chung nằm ở đâu. Trang IAM và Networking sẽ đào sâu vào hai chủ đề bạn đụng tới mỗi ngày.

Kiến thức nền tảng

Hạ tầng toàn cầu: region, zone và edge

GCP được dựng từ ba tầng vật lý:

TầngLà gìPhạm viVí dụ
RegionMột khu vực địa lý độc lậpVùng cô lậpus-central1 (Iowa), europe-west1 (Bỉ), asia-southeast1 (Singapore)
ZoneMột khu triển khai trong region (đại khái một hoặc một cụm datacenter)Failure domain (miền lỗi)us-central1-a, us-central1-b
Edge / POPPoints of Presence trên mạng toàn cầu của Google để cache và ingressGlobal (180+ vị trí)Dùng bởi Cloud CDN, Global Load Balancing, Premium Tier networking

Điểm mấu chốt:

Ánh xạ tên gọi AWS ↔ GCP:

Khái niệmAWSGCP
Khu vực địa lýRegionRegion
Nhóm datacenter cô lậpAvailability Zone (AZ)Zone
Vị trí cache biênCloudFront edgeEdge POP / Cloud CDN
Mạng ảoVPC (regional)VPC (global)
Object storageS3Cloud Storage (GCS)
Máy ảoEC2Compute Engine
Managed KubernetesEKSGKE
Ranh giới tài khoảnAccountProject
Nhóm tổ chứcOrganizational Unit (OU)Folder

Resource hierarchy (phân cấp tài nguyên)

Mọi thứ bạn tạo trong GCP đều nằm trong một cây. Cây này không phải để trang trí — IAM policy và Organization Policy được thừa kế xuống dưới, còn billing thì gom lên trên.

Organization  (công ty bạn, gắn với domain Cloud Identity / Workspace)
└── Folder  (ví dụ "Engineering")
    └── Folder  (ví dụ "Team-Payments")
        └── Project  (ví dụ "payments-prod")
            └── Resources  (VM, bucket, GKE cluster, Pub/Sub topic…)

Project & billing account

Billing tách rời khỏi phân cấp: Billing Account là một đối tượng riêng mà project được liên kết tới.

Khái niệm chính

Global vs regional vs zonal

Biết phạm vi của một resource cho bạn biết failure domain của nó và cách tham chiếu tới nó.

Phạm viÝ nghĩaVí dụ
GlobalKhông gắn với region nào; một thực thể phục vụ khắp nơiVPC network, firewall rule, route, Global HTTP(S) Load Balancer, Cloud DNS, IAM, image, snapshot
RegionalSống trong một region, trải các zone của region đóSubnet, regional MIG, regional persistent disk, Cloud SQL, regional GKE, regional load balancer
ZonalSống trong một zone duy nhấtVM Compute Engine, zonal persistent disk, zonal GKE node, zonal MIG

Hệ quả thực tế: VPC là global, nhưng subnet của nó là regional. Bạn tạo một VPC và thêm một subnet cho mỗi region khi cần — rất khác AWS, nơi VPC gắn cứng với một region và muốn nối liên region phải peering.

Trách nhiệm chung (và shared fate)

Google bảo vệ hạ tầng cloud; bạn bảo vệ những gì bạn đặt lên đó. Ranh giới dịch chuyển theo mô hình dịch vụ:

LớpIaaS (Compute Engine)Managed (Cloud SQL, GKE)Serverless (Cloud Run, Functions)
Vật lý / phần cứngGoogleGoogleGoogle
Hạ tầng mạngGoogleGoogleGoogle
Host OS / hypervisorGoogleGoogleGoogle
Vá guest OSBạnGoogleGoogle
Runtime / middlewareBạnChia sẻGoogle
Code ứng dụngBạnBạnBạn
Dữ liệu & kiểm soát truy cập (IAM)BạnBạnBạn

IAM, phân loại dữ liệu và quản lý truy cập luôn là của bạn, bất kể dịch vụ nào. Google còn công bố mô hình Shared Fate — đi xa hơn ranh giới bằng cách cung cấp secure default, blueprint (ví dụ security foundations blueprint) và guardrail để “con đường lát sẵn” cũng chính là con đường an toàn.

Google Cloud Architecture Framework

Bản tương đương của AWS Well-Architected Framework. Sáu trụ cột để đánh giá mọi thiết kế:

  1. Operational excellence — tự động hóa, observability, ứng cứu sự cố.
  2. Security, privacy & compliance — least privilege, phòng thủ theo tầng.
  3. Reliability — SLO, dự phòng qua zone/region, suy giảm nhẹ nhàng.
  4. Cost optimization — right-sizing, discount, lifecycle policy.
  5. Performance optimization — tài nguyên phù hợp, caching, tầm phủ toàn cầu.
  6. Sustainability — chọn region theo mức carbon.

Các cách truy cập GCP

CáchLà gìKhi nào dùng
Cloud ConsoleGiao diện web (console.cloud.google.com)Khám phá, thay đổi lẻ, dashboard
gcloud CLICông cụ dòng lệnh (thuộc Cloud SDK)Scripting, automation, CI/CD
Cloud ShellVM trên trình duyệt cài sẵn SDK, home 5 GB lưu bềnQuản trị nhanh không cần cài local
Client librariesSDK bản ngữ (Go, Python, Java, Node, …)Code ứng dụng gọi API GCP
REST / gRPC APIsEndpoint HTTP/gRPC nền tảngTooling tùy biến, ngôn ngữ chưa hỗ trợ
Terraform / Config ConnectorInfrastructure as CodeHạ tầng tái lập, có review

Thiết lập gcloud cơ bản:

gcloud auth login                        # credential người dùng
gcloud config set project payments-prod  # project mặc định cho lệnh
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a

# Named configuration cho phép đổi ngữ cảnh (prod / dev)
gcloud config configurations create prod
gcloud config configurations activate prod
gcloud config configurations list

Kiến thức nền về giá

Giá của GCP nổi tiếng vì các discount tự động, chi tiết:

Ước lượng trước khi build bằng Google Cloud Pricing Calculator.

Organization Policy (giới thiệu)

Khác với IAM. IAM kiểm soát ai được làm gì; Organization Policy Service kiểm soát cái gì được phép tồn tại và tồn tại thế nào, như những guardrail đặt ở cấp org/folder/project và thừa kế xuống dưới.

Các constraint thường gặp:

Chúng được thực thi cả với Project Owner, nên là một control tuân thủ rất mạnh. Xem trang IAM để biết chi tiết.

Best Practices

  1. Thiết kế phân cấp trước khi mở rộng. Dùng folder theo phòng ban và project riêng cho từng môi trường (app-dev, app-staging, app-prod). Đặt IAM và org policy cao trong cây để cascade — dễ hơn nhiều so với sửa lại về sau.
  2. Một workload/môi trường cho một project. Project là blast radius của IAM, quota và billing. Cô lập chúng giới hạn thiệt hại khi sai sót hoặc bị xâm nhập và làm cost attribution cực dễ.
  3. Không bao giờ dùng role Owner cấp org cho việc hằng ngày. Để dành cho break-glass; hãy cấp predefined role least-privilege (xem trang IAM).
  4. Bật org policy từ ngày đầu. Tối thiểu: chặn tạo SA key, hạn chế external IP, và ghim resourceLocations vào các region tuân thủ — guardrail rẻ tiền ngăn được sai lầm đắt giá.
  5. Gắn label cho mọi thứ. Bắt buộc label env, team, cost-center; không có chúng thì không thể phân tích chi phí hay bảo mật một cách nghiêm túc.
  6. Export billing sang BigQuery và đặt budget kèm alert. Phát hiện chi tiêu thất thoát sớm; dựng dashboard showback/chargeback từ export.
  7. Dùng committed-use discount cho tải nền ổn định và để sustained-use discount lo phần còn lại — rồi thêm Spot VM cho công suất co giãn/batch.
  8. Ưu tiên Spot VM cho mọi thứ chịu lỗi (CI runner, batch, dev). Tiết kiệm lớn và rủi ro thu hồi quản lý được bằng retry và MIG.
  9. Chọn region có chủ đích theo latency, data residency/compliance, chi phí (giá khác nhau theo region) và mức carbon — đừng chỉ dùng “mặc định”.
  10. Thiết kế chịu lỗi zone theo mặc định. Trải qua ≥2 zone; dùng regional managed instance group và regional persistent disk cho dịch vụ stateful.
  11. Quản lý hạ tầng bằng code (Terraform + Config Connector). Click console không mở rộng được, không review được, và drift âm thầm.
  12. Dùng named gcloud configuration (hoặc service account riêng) để tách bạch ngữ cảnh prod và non-prod, tránh tai nạn “nhầm project”.
  13. Dùng Architecture Framework làm checklist review cho mọi thiết kế đáng kể; nó bắt được các lỗ hổng reliability và chi phí trước khi launch.
  14. Bật Cloud Asset Inventory và Security Command Center để có bản ghi liên tục, truy vấn được về những gì đang tồn tại và trạng thái bảo mật của chúng.
  15. Dùng một project “seed”/bootstrap chuyên biệt, khóa chặt cho automation cấp org (Terraform state, org policy) để cấu hình nền không lẫn với workload.

Tài liệu tham khảo

Part of the Cloud knowledge base — GCP deep dive. Complements DevOps Roadmap.

Overview

Google Cloud Platform (GCP) is Google’s public cloud, running on the same infrastructure that powers Google Search, Gmail, YouTube, and Maps. For a DevOps engineer arriving from AWS or Azure, the two biggest mental shifts are that GCP treats many core services as global rather than regional, and that everything you create lives inside a strict resource hierarchy (Organization → Folders → Projects → resources) that is the single anchor point for IAM, billing, and policy.

This page is the map of the territory: how Google’s physical network is laid out, how the logical hierarchy works, how you pay, how you access things, and where the shared-responsibility line sits. The IAM and Networking pages go deep on the two topics you will touch every single day.

Fundamentals

Global infrastructure: regions, zones, and edge

GCP is built from three physical tiers:

TierWhat it isScopeExample
RegionAn independent geographic areaIsolated areaus-central1 (Iowa), europe-west1 (Belgium), asia-southeast1 (Singapore)
ZoneA deployment area within a region (roughly a datacenter or cluster of them)Failure domainus-central1-a, us-central1-b
Edge / POPPoints of Presence on Google’s global network for caching and ingressGlobal (180+ locations)Used by Cloud CDN, Global Load Balancing, Premium Tier networking

Key facts:

AWS ↔ GCP equivalents (naming):

ConceptAWSGCP
Geographic areaRegionRegion
Isolated datacenter groupAvailability Zone (AZ)Zone
Edge cache locationCloudFront edgeEdge POP / Cloud CDN
Virtual networkRegional VPCGlobal VPC
Object storageS3Cloud Storage (GCS)
Virtual machineEC2Compute Engine
Managed KubernetesEKSGKE
Account boundaryAccountProject
Org groupingOrganizational Unit (OU)Folder

The resource hierarchy

Everything you create in GCP lives in a tree. This tree is not cosmetic — IAM policies and Organization Policies are inherited down it, and billing rolls up it.

Organization  (your company, tied to a Cloud Identity / Workspace domain)
└── Folder  (e.g. "Engineering")
    └── Folder  (e.g. "Team-Payments")
        └── Project  (e.g. "payments-prod")
            └── Resources  (VMs, buckets, GKE clusters, Pub/Sub topics…)

Projects & billing accounts

Billing is decoupled from the hierarchy: a Billing Account is a separate object that projects are linked to.

Key Concepts

Global vs regional vs zonal resources

Knowing a resource’s scope tells you its failure domain and how you reference it.

ScopeMeaningExamples
GlobalNot tied to any region; one instance serves everywhereVPC network, firewall rules, routes, Global HTTP(S) Load Balancer, Cloud DNS, IAM, images, snapshots
RegionalLives in one region, spans that region’s zonesSubnets, regional MIGs, regional persistent disks, Cloud SQL, regional GKE, regional load balancers
ZonalLives in a single zoneCompute Engine VM, zonal persistent disk, zonal GKE node, zonal MIG

Practical implication: a VPC is global, but its subnets are regional. You create one VPC and add a subnet per region as needed — very different from AWS, where a VPC is bound to one region and cross-region connectivity needs peering.

Shared responsibility (and shared fate)

Google secures the cloud; you secure what you put in it. The line moves with the service model:

LayerIaaS (Compute Engine)Managed (Cloud SQL, GKE)Serverless (Cloud Run, Functions)
Physical / hardwareGoogleGoogleGoogle
Network infraGoogleGoogleGoogle
Host OS / hypervisorGoogleGoogleGoogle
Guest OS patchingYouGoogleGoogle
Runtime / middlewareYouSharedGoogle
App codeYouYouYou
Data & access control (IAM)YouYouYou

IAM, data classification, and access management are always yours, regardless of service. Google also publishes a Shared Fate model — going beyond the line by providing secure defaults, blueprints (e.g. the security foundations blueprint), and guardrails so the paved path is the secure path.

Google Cloud Architecture Framework

Google’s equivalent of the AWS Well-Architected Framework. Six pillars to evaluate any design against:

  1. Operational excellence — automation, observability, incident response.
  2. Security, privacy & compliance — least privilege, defense in depth.
  3. Reliability — SLOs, redundancy across zones/regions, graceful degradation.
  4. Cost optimization — right-sizing, discounts, lifecycle policies.
  5. Performance optimization — appropriate resources, caching, global reach.
  6. Sustainability — carbon-aware region selection.

Ways to access GCP

MethodWhat it isWhen to use
Cloud ConsoleWeb UI (console.cloud.google.com)Exploration, one-off changes, dashboards
gcloud CLICommand-line tool (part of the Cloud SDK)Scripting, automation, CI/CD
Cloud ShellBrowser-based VM with SDK pre-installed, 5 GB persistent homeQuick admin without local setup
Client librariesIdiomatic SDKs (Go, Python, Java, Node, …)Application code calling GCP APIs
REST / gRPC APIsThe underlying HTTP/gRPC endpointsCustom tooling, unsupported languages
Terraform / Config ConnectorInfrastructure as CodeReproducible, reviewed infra

Basic gcloud setup:

gcloud auth login                        # user credentials
gcloud config set project payments-prod  # default project for commands
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a

# Named configurations let you switch contexts (prod / dev)
gcloud config configurations create prod
gcloud config configurations activate prod
gcloud config configurations list

Pricing fundamentals

GCP’s pricing is known for granular, automatic discounts:

Estimate before you build with the Google Cloud Pricing Calculator.

Organization Policies (intro)

Distinct from IAM. IAM controls who can do what; the Organization Policy Service controls what is allowed to exist and how, as guardrails set at org/folder/project level and inherited down.

Common constraints:

These are enforced even against Project Owners, which makes them a strong compliance control. See the IAM page for details.

Best Practices

  1. Model your hierarchy before scaling. Use folders per department and separate projects per environment (app-dev, app-staging, app-prod). Apply IAM and org policy high in the tree so it cascades — far easier than retrofitting later.
  2. One workload/environment per project. Projects are the blast radius for IAM, quotas, and billing. Isolating them limits the damage of a mistake or compromise and makes cost attribution trivial.
  3. Never use the org-level Owner role for daily work. Reserve it for break-glass; grant least-privilege predefined roles instead (see IAM page).
  4. Turn on org policies from day one. At minimum disable SA key creation, restrict external IPs, and pin resourceLocations to your compliance regions — cheap guardrails that prevent expensive mistakes.
  5. Label everything. Enforce env, team, and cost-center labels; you cannot do meaningful cost or security analysis without them.
  6. Export billing to BigQuery and set budgets with alerts. Detect runaway spend early; build showback/chargeback dashboards from the export.
  7. Use committed-use discounts for steady baseline load and let sustained-use discounts cover the rest — then add Spot VMs for elastic/batch capacity.
  8. Prefer Spot VMs for anything fault-tolerant (CI runners, batch, dev). The savings are large and the reclaim risk is manageable with retries and MIGs.
  9. Choose regions deliberately for latency, data residency/compliance, cost (prices vary by region), and carbon footprint — not just “the default”.
  10. Design for zone failure by default. Spread across ≥2 zones; use regional managed instance groups and regional persistent disks for stateful services.
  11. Manage infrastructure as code (Terraform + Config Connector). Console clicks don’t scale, aren’t reviewable, and drift silently.
  12. Use named gcloud configurations (or separate service accounts) to keep prod and non-prod contexts firmly separated and avoid “wrong project” accidents.
  13. Adopt the Architecture Framework as a review checklist for every non-trivial design; it catches reliability and cost gaps before launch.
  14. Enable Cloud Asset Inventory and Security Command Center to keep a continuous, queryable record of what exists and its security posture.
  15. Use a dedicated, locked-down “seed”/bootstrap project for org-level automation (Terraform state, org policies) so foundational config is not tangled with workloads.

References