Ngân hàng đề — Google Cloud Professional Cloud Developer

Tìm thấy 358 câu.

Câu 161
You are building a mobile application that will store hierarchical data structures in a database. The application will enable users working offline to sync changes when they are back online. A backend service will enrich the data in the database using a service account. The application is expected to be very popular and needs to scale seamlessly and securely. Which database and IAM role should you use?
  1. A Use Cloud SQL, and assign the roles/cloudsql.editor role to the service account.
  2. B Use Bigtable, and assign the roles/bigtable.viewer role to the service account.
  3. C Use Firestore in Native mode and assign the roles/datastore.user role to the service account.
  4. D Use Firestore in Datastore mode and assign the roles/datastore.viewer role to the service account.
Xem giải thích

📖 Giải thích nội dung câu hỏi

🧩 Câu hỏi yêu cầu chọn cơ sở dữ liệu (database) và vai trò IAM phù hợp cho một ứng dụng di động (mobile app):

  • Ứng dụng lưu trữ dữ liệu phân cấp (hierarchical data structures), như cây thư mục hoặc dữ liệu lồng nhau.
  • Hỗ trợ người dùng làm việc ngoại tuyến (offline) và đồng bộ thay đổi khi online.
  • Dịch vụ backend sử dụng service account để làm phong phú dữ liệu (enrich data) trong database.
  • Ứng dụng phổ biến cao, cần mở rộng liền mạch (scale seamlessly) và bảo mật (securely).

🛠️ Yêu cầu chính từ GCP (cập nhật đến 2024-2026): Database phải hỗ trợ hierarchical data (như document/subcollection), offline sync (persistence & sync tự động), auto-scaling, và IAM role cho service account có quyền đọc/ghi phù hợp. Firestore là lựa chọn lý tưởng cho mobile app với Firebase SDK.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Use Firestore in Native mode and assign the roles/datastore.user role to the service account.

Lý do chi tiết 🏆:

  • Firestore in Native mode (phiên bản đầy đủ của Firestore): Hoàn hảo cho hierarchical data qua documents và subcollections, hỗ trợ offline persistence & real-time sync qua Firebase SDK (cập nhật mới nhất Firebase v10+ năm 2024). Auto-scales serverless, phù hợp app phổ biến.
  • roles/datastore.user: Cho phép service account đọc/ghi (read/write) dữ liệu Firestore/Datastore một cách an toàn, lý tưởng cho backend enrich data. Không quá rộng (như admin) nên secure.
  • ✅ Phù hợp toàn bộ yêu cầu: Offline sync chỉ có ở Native mode, scale seamless với multi-region replication (cập nhật GCP 2025).

🔍 Phân tích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng lựa chọn giữ nguyên văn bản gốc bằng tiếng Anh, với giải thích sai/đúng bằng tiếng Việt dựa trên docs GCP mới nhất (Firestore Native mode ưu tiên cho mobile/offline từ 2019+, IAM roles cập nhật 2024).

  • ❌ [SAI] Use Cloud SQL, and assign the roles/cloudsql.editor role to the service account.
    🧨 Lý do sai: Cloud SQL là relational DB (MySQL/PostgreSQL), không hỗ trợ hierarchical data tự nhiên (cần schema phức tạp), không có offline sync native cho mobile. Chỉ scale vertically/horizontally thủ công, không seamless như NoSQL. Role cloudsql.editor cho edit instance nhưng không tối ưu cho enrich data real-time.

  • ❌ [SAI] Use Bigtable, and assign the roles/bigtable.viewer role to the service account.
    🚫 Lý do sai: Bigtable là wide-column NoSQL, tốt cho massive scale nhưng không hỗ trợ hierarchical data (thiếu nested structures), không có offline sync cho mobile app. Role bigtable.viewer chỉ đọc (read-only), không đủ cho backend enrich (cần write). Không phù hợp mobile/popular app.

  • ✅ [ĐÚNG] Use Firestore in Native mode and assign the roles/datastore.user role to the service account.
    🏅 Lý do đúng: Như đã giải thích ở trên. Firestore Native mode (full features) hỗ trợ hierarchical (documents/subcollections), offline sync (local cache + auto-sync), auto-scale serverless (lên hàng triệu ops/sec), IAM role datastore.user an toàn cho read/write. Lý tưởng cho mobile với Firebase (cập nhật 2025: improved offline conflict resolution).

  • ❌ [SAI] Use Firestore in Datastore mode and assign the roles/datastore.viewer role to the service account.
    ⚠️ Lý do sai: Firestore in Datastore mode (legacy, dùng Datastore API) thiếu offline sync & real-time features của Native mode, chỉ scale như Datastore cũ (không seamless cho popular app). Role datastore.viewer chỉ đọc, không write để enrich data. GCP khuyến nghị migrate sang Native mode (docs 2024+).

📘 Tài liệu tham khảo (GCP docs cập nhật 2024-2026)

Hy vọng phân tích giúp bạn ôn thi hiệu quả! 🚀 Nếu cần thêm ví dụ code, hỏi nhé!

Câu 162
Your application is deployed on hundreds of Compute Engine instances in a managed instance group (MIG) in multiple zones. You need to deploy a new instance template to fix a critical vulnerability immediately but must avoid impact to your service. What setting should be made to the MIG after updating the instance template?
  1. A Set the Max Surge to 100%.
  2. B Set the Update mode to Opportunistic.
  3. C Set the Maximum Unavailable to 100%.
  4. D Set the Minimum Wait time to 0 seconds.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi tập trung vào quản lý cập nhật (rolling update) trong Managed Instance Group (MIG) trên Google Cloud Compute Engine. Ứng dụng đang chạy trên hàng trăm instances thuộc MIG trải rộng nhiều zones. Yêu cầu là deploy instance template mới ngay lập tức để vá lỗ hổng bảo mật nghiêm trọng (critical vulnerability), nhưng phải tránh ảnh hưởng đến dịch vụ (zero downtime hoặc minimal impact).

Sau khi cập nhật instance template, cần thay đổi setting nào trên MIG để rollout update nhanh chóng và an toàn? Đây là tình huống thực tế trong production, nơi cần cân bằng giữa tốc độ vá lỗi (immediately) và tính sẵn sàng cao (SLA cao, tránh disruption). MIG sử dụng update policy (rolling update) với các tham số như surge, unavailable, wait time để kiểm soát quá trình thay thế instances cũ bằng instances mới từ template mới. 📘

✅ Đáp án đúng: Set the Minimum Wait time to 0 seconds

Lý do chọn đáp án này:
Trong MIG update policy, Minimum Wait time (hay chính xác là minReadySec trong docs GCP) quy định thời gian tối thiểu (tính bằng giây) mà một instance mới phải "ready" (healthy và sẵn sàng phục vụ) trước khi MIG thay thế instance cũ tiếp theo. Mặc định là 0 giây, nhưng nếu set cao hơn, rollout sẽ chậm lại để đảm bảo stability.

Để fix vulnerability ngay lập tức mà không impact service, set giá trị này về 0 seconds sẽ cho phép MIG rollout update nhanh nhất có thể (không chờ validation dài dòng), kết hợp với surge/unavailable hợp lý để duy trì capacity. Điều này đảm bảo instances mới được deploy và thay thế cũ nhanh chóng, giảm thời gian exposure lỗ hổng mà vẫn giữ traffic ổn định. Theo best practice GCP (cập nhật 2024-2026), đây là cách tối ưu cho critical patches. 🛠️

Tài liệu tham khảo:

📋 Giải thích tất cả các phương án

Dưới đây là phân tích từng lựa chọn một cách chi tiết, giữ nguyên văn bản gốc tiếng Anh. Tôi đánh dấu ✅/❌ và giải thích lý do đúng/sai dựa trên hành vi của MIG rolling update (phiên bản mới nhất GCP 2026, không thay đổi lớn so 2024).

  • ❌ Set the Max Surge to 100%.
    Giải thích sai: Max Surge (%) kiểm soát số lượng instances mới TẠO THÊM tạm thời trong quá trình update (ví dụ 100% = double số instances). Setting 100% giúp scale up nhanh để bù đắp unavailable, nhưng KHÔNG làm update "immediately" vì vẫn phụ thuộc vào các yếu tố khác như minReadySec hoặc batch size. Nó có thể tăng chi phí (over-provisioning) và không trực tiếp đẩy nhanh rollout toàn bộ MIG lớn (hundreds instances). Không phù hợp cho zero-impact critical fix. 🛑

  • ❌ Set the Update mode to Opportunistic.
    Giải thích sai: Update mode "Opportunistic" (default) chờ instances healthy trước khi update, chỉ thay thế khi có slot available và VM ready, dẫn đến rollout CHẬM (có thể mất hàng giờ/ngày cho hundreds instances). Để fix immediately, cần mode "Proactive" (force update nhanh), không phải Opportunistic. Setting này sẽ trì hoãn vá lỗ hổng, tăng rủi ro bảo mật. 🚫

  • ❌ Set the Maximum Unavailable to 100%.
    Giải thích sai: Maximum Unavailable (%) cho phép số instances CÓ THỂ TẮT/TỰ ĐỘNG UNAVAILABLE trong update (100% = toàn bộ MIG có thể down cùng lúc). Điều này gây downtime nghiêm trọng, vi phạm yêu cầu "avoid impact to your service". Dù rollout nhanh, nhưng rủi ro mất service hoàn toàn, không an toàn cho production multi-zone. 😱

  • ✅ Set the Minimum Wait time to 0 seconds.
    (Đã giải thích chi tiết ở phần đáp án đúng ở trên). Đây là setting tối ưu để tăng tốc độ rollout ngay lập tức mà vẫn kiểm soát surge/unavailable để zero-impact. 🎉

Lưu ý cuối: Trong thực tế, kết hợp với Proactive mode, max surge 20-30%, max unavailable 0-10%, và minReadySec=0 để best result. Sử dụng gcloud CLI: gcloud compute instance-groups managed set-instance-template + update policy. Nếu MIG lớn, monitor qua Cloud Monitoring! 🔍

Câu 163
You made a typo in a low-level Linux configuration file that prevents your Compute Engine instance from booting to a normal run level. You just created the Compute Engine instance today and have done no other maintenance on it, other than tweaking files. How should you correct this error?
  1. A Download the file using scp, change the file, and then upload the modified version
  2. B Configure and log in to the Compute Engine instance through SSH, and change the file
  3. C Configure and log in to the Compute Engine instance through the serial port, and change the file
  4. D Configure and log in to the Compute Engine instance using a remote desktop client, and change the file
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả tình huống: Bạn đã mắc lỗi chính tả (typo) trong một file cấu hình Linux cấp thấp (low-level Linux configuration file), dẫn đến Compute Engine instance (máy ảo trên Google Cloud Platform - GCP) không thể boot lên run level bình thường (không khởi động đầy đủ vào chế độ hoạt động chuẩn). Instance này vừa được tạo hôm nay, và bạn chỉ thực hiện chỉnh sửa file, chưa làm bảo trì gì khác.

Mục tiêu: Tìm cách sửa lỗi này một cách hiệu quả nhất.
Vấn đề cốt lõi là instance không boot được đầy đủ, nên các phương thức truy cập thông thường (như SSH) sẽ thất bại vì hệ thống chưa sẵn sàng. Bạn cần một cách truy cập không phụ thuộc vào hệ điều hành boot đầy đủ. Đây là tình huống phổ biến trong GCP khi gặp lỗi kernel hoặc initramfs, và giải pháp chuẩn là sử dụng Serial Port Console (cổng nối tiếp) để truy cập recovery mode.

(Kiến thức cập nhật đến 2026: Theo tài liệu GCP mới nhất, Serial Console vẫn là công cụ chính thức cho troubleshooting boot failure trên Compute Engine, hỗ trợ interactive access ngay cả khi instance stuck ở grub hoặc emergency mode. Nguồn: Google Cloud Compute Engine Serial Console và Troubleshoot boot issues.)

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Configure and log in to the Compute Engine instance through the serial port, and change the file

Lý do:

  • Serial Port Console (cổng nối tiếp) cho phép truy cập trực tiếp vào console của instance mà không cần SSH hoặc mạng, ngay cả khi instance không boot đầy đủ (stuck ở runlevel 1/emergency hoặc kernel panic).
  • Bạn có thể login vào root shell qua serial console, mount filesystem nếu cần, và sửa file config trực tiếp (ví dụ: /etc/fstab, grub.cfg).
  • Instance mới tạo nên chưa có snapshot/custom image phức tạp, Serial Console là cách nhanh nhất, không downtime lâu.
  • 🛠️ Quy trình: Vào GCP Console > Compute Engine > VM instances > [Instance] > Remote access > Connect to serial console. Enable nếu chưa (metadata serial-port-enable=true).

📋 Giải thích tất cả các phương án (đúng/sai)

  • ❌ [SAI] Download the file using scp, change the file, and then upload the modified version
    Phương án này không khả thi vì SCP (Secure Copy) dựa trên SSH, mà SSH yêu cầu instance boot đầy đủ và SSH daemon chạy (port 22 mở). Instance đang không boot bình thường, nên không thể kết nối SCP → thất bại ngay từ đầu. Không phù hợp cho lỗi low-level config.

  • ❌ [SAI] Configure and log in to the Compute Engine instance through SSH, and change the file
    SSH phụ thuộc vào hệ thống boot hoàn chỉnh (network stack, SSH service khởi động). Với lỗi config low-level (như /etc/inittab hoặc fstab), instance stuck ở early boot stage, SSH không available → connection refused hoặc timeout. Không dùng được trong trường hợp này.

  • ✅ [ĐÚNG] Configure and log in to the Compute Engine instance through the serial port, and change the file
    Như đã giải thích ở trên: Serial Console bypass boot failure, cung cấp TTY access trực tiếp (giống ngồi trước máy vật lý). Bạn có thể chỉnh sửa file ngay trong recovery shell, reboot sau khi fix. Đây là best practice của GCP cho troubleshooting (xem nguồn tài liệu ở phần phân tích câu hỏi).

  • ❌ [SAI] Configure and log in to the Compute Engine instance using a remote desktop client, and change the file
    Remote desktop (như VNC/RDP) yêu cầu GUI desktop environment boot đầy đủ (X11/Wayland), nhưng lỗi low-level Linux config thường ngăn boot kernel/init, nên không có desktop session. Compute Engine mặc định không hỗ trợ RDP/VNC native mà cần setup thủ công (gcloud compute start-iap-tunnel), và vẫn fail nếu không boot → hoàn toàn không áp dụng.

Tóm tắt nhanh 🏁: Serial Console là "cứu cánh" cho boot issues trên GCP. Nếu fix xong, reboot instance để kiểm tra! (Tham khảo thêm: GCP Best Practices for Compute Engine recovery - cloud.google.com/compute/docs/instances/interacting-with-serial-console).

Câu 164
You are developing an application that needs to store files belonging to users in Cloud Storage. You want each user to have their own subdirectory in Cloud Storage. When a new user is created, the corresponding empty subdirectory should also be created. What should you do?
  1. A Create an object with the name of the subdirectory ending with a trailing slash ('/') that is zero bytes in length.
  2. B Create an object with the name of the subdirectory, and then immediately delete the object within that subdirectory.
  3. C Create an object with the name of the subdirectory that is zero bytes in length and has WRITER access control list permission.
  4. D Create an object with the name of the subdirectory that is zero bytes in length. Set the Content-Type metadata to CLOUDSTORAGE_FOLDER.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi

Câu hỏi này thuộc chủ đề Google Cloud Storage (GCS) (không phải AWS như đề cập nhầm, vì GCS là dịch vụ lưu trữ object của Google Cloud, tương tự S3 của AWS nhưng với cơ chế "folder" đặc trưng).

✅ Nội dung chính: Bạn đang xây dựng một ứng dụng cần lưu trữ file thuộc về từng người dùng trong GCS. Yêu cầu:

  • Mỗi người dùng có thư mục con (subdirectory) riêng biệt trong một bucket GCS.
  • Khi tạo người dùng mới, phải tự động tạo thư mục con rỗng tương ứng (empty subdirectory).

🛠️ Bối cảnh kỹ thuật: GCS không hỗ trợ thư mục thực thụ (physical folders) như hệ thống file truyền thống. Thay vào đó, thư mục chỉ là prefix ảo dựa trên tên object (object name). GCS console và gsutil sẽ hiển thị chúng như thư mục nếu tên object kết thúc bằng '/' (trailing slash) và có kích thước 0 byte. Điều này giúp UI thân thiện, dễ quản lý file theo cấu trúc cây thư mục (ví dụ: gs://bucket/user123/ đại diện cho thư mục của user123).

📘 Phiên bản cập nhật: Theo tài liệu GCS mới nhất (cập nhật đến 2024-2026, không thay đổi cơ bản từ các phiên bản trước như v1 API), cách tạo "empty folder" vẫn giữ nguyên: upload zero-byte object với trailing slash. Không có thay đổi lớn từ Google Cloud Next 2024 hoặc I/O 2025.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create an object with the name of the subdirectory ending with a trailing slash ('/') that is zero bytes in length.

Lý do chi tiết:

  • Đây là phương pháp chuẩn và được khuyến nghị bởi Google để mô phỏng thư mục rỗng trong GCS.
  • Khi upload object zero-byte (0 bytes) với tên như user123/ (kết thúc bằng '/'), GCS sẽ tự động hiển thị nó như một thư mục trống trong Console, gsutil, và các công cụ khác.
  • Không cần quyền đặc biệt hay metadata thêm; chỉ cần PUT object thông thường.
  • Khi upload file vào thư mục này (ví dụ: user123/file.txt), nó sẽ nằm gọn trong cấu trúc thư mục ảo.
  • ✅ Ưu điểm: Đơn giản, hiệu suất cao, không tốn storage thực (zero-byte), và tương thích hoàn toàn với SDK (Python, Java, Node.js) qua storage_client.bucket().blob('user123/').upload_from_string('').

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng phương án một, giữ nguyên văn bản gốc tiếng Anh. Mỗi giải thích sử dụng emoji để nổi bật: ✅ đúng / ❌ sai, kèm lý do kỹ thuật chi tiết bằng tiếng Việt.

  • Create an object with the name of the subdirectory ending with a trailing slash ('/') that is zero bytes in length.
    ✅ ĐÚNG. Như đã giải thích ở trên, đây là cách chính thức để tạo thư mục ảo rỗng. Trailing slash ('/') kích hoạt hiển thị folder trong UI, zero-byte giữ thư mục "rỗng" thực sự. Hoạt động ngay lập tức mà không cần bước phụ.

  • Create an object with the name of the subdirectory, and then immediately delete the object within that subdirectory.
    ❌ SAI. Tạo object rồi xóa ngay không tạo ra thư mục ảo. GCS chỉ nhận diện folder qua prefix kết thúc '/', không qua hành động tạo-xóa tạm thời. Phương pháp này vô ích, có thể gây lỗi race condition (nếu xóa quá nhanh), và lãng phí API calls.

  • Create an object with the name of the subdirectory that is zero bytes in length and has WRITER access control list permission.
    ❌ SAI. Zero-byte object mà không có trailing slash ('/') sẽ chỉ là file rỗng thông thường, không hiển thị như thư mục trong Console/gsutil. WRITER ACL chỉ kiểm soát quyền ghi (IAM/ACL), không ảnh hưởng đến việc tạo folder ảo. ACL thừa thãi và không giải quyết vấn đề cốt lõi.

  • Create an object with the name of the subdirectory that is zero bytes in length. Set the Content-Type metadata to CLOUDSTORAGE_FOLDER.
    ❌ SAI. Không có metadata Content-Type: CLOUDSTORAGE_FOLDER chuẩn trong GCS (đây là metadata giả định, không tồn tại). Zero-byte mà thiếu trailing slash vẫn chỉ là file rỗng. GCS dùng tên object với '/' để infer folder, không dựa vào Content-Type. Sử dụng metadata này có thể gây lỗi validation.

📚 Tài liệu tham khảo (dẫn nguồn chính thức)

🛠️ Lời khuyên thực tế: Trong code, dùng Google Cloud Client Library (ví dụ Python: blob = bucket.blob('user123/'); blob.upload_from_string(data='', content_type='application/x-empty')). Nếu cần auto-create khi user đăng ký, tích hợp vào Cloud Function hoặc backend app!

Câu 165
Your company’s corporate policy states that there must be a copyright comment at the very beginning of all source files. You want to write a custom step in Cloud Build that is triggered by each source commit. You need the trigger to validate that the source contains a copyright and add one for subsequent steps if not there. What should you do?
  1. A Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
  2. B Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files do not need to be committed back to the source repository.
  3. C Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are written back to the Cloud Storage bucket.
  4. D Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
Xem giải thích

🧩 Phân tích chi tiết câu hỏi

📘 Nội dung câu hỏi:
Câu hỏi xoay quanh chính sách công ty yêu cầu mọi file nguồn (source files) phải có comment bản quyền (copyright comment) ngay ở đầu file. Bạn cần tạo một bước tùy chỉnh (custom step) trong Cloud Build, được kích hoạt bởi mỗi commit nguồn (source commit). Nhiệm vụ của trigger này là:

  • Kiểm tra (validate) xem source code có chứa copyright không.
  • Nếu không có, thì thêm copyright vào để các bước build tiếp theo (subsequent steps) có thể sử dụng.

🛠️ Bối cảnh kỹ thuật (Google Cloud Build):

  • Cloud Build tự động checkout mã nguồn từ repository (như Cloud Source Repositories hoặc GitHub/Cloud Source Repositories connected repo) vào thư mục /workspace khi build bắt đầu.
  • Custom step là một Docker container bạn build và push lên Container Registry/Artifact Registry, sau đó thêm vào cloudbuild.yaml.
  • Mục tiêu là enforce policy tự động: validate + sửa nếu cần, đảm bảo repo luôn tuân thủ và build thành công.
  • Kiến thức cập nhật đến 2026: Cloud Build vẫn sử dụng /workspace làm working directory chuẩn (không thay đổi từ các phiên bản trước), hỗ trợ git operations trong container để commit/push back (cần config credentials via service account với quyền Source.Repositories.Writer).

✅ Đáp án đúng:
Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.

Lý do chọn đáp án đúng (chi tiết):

  • ✅ Examine /workspace: Đúng vì Cloud Build checkout source vào /workspace, container chạy step này có quyền đọc/ghi trực tiếp.
  • ✅ Checks and adds copyright: Container có thể dùng script (bash/Python) để grep kiểm tra đầu file, thêm header nếu thiếu (ví dụ sed/awk).
  • ✅ Explicitly committed back: Quan trọng nhất! Thay đổi chỉ ảnh hưởng build hiện tại nếu không commit. Phải dùng git add/commit/push trong container (với $COMMIT_SHA, $REPO_NAME từ substitutions) để cập nhật repo gốc, enforce policy lâu dài. Nếu không commit, commit tiếp theo vẫn thiếu copyright → vi phạm policy.
  • Đây là cách chuẩn theo best practices GCP (2026), đảm bảo atomicity và audit trail.

📋 Giải thích tất cả các phương án (sử dụng emoji đánh dấu đúng/sai)

  • ✅ [ĐÚNG] Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
    Như phân tích trên: Hoàn hảo khớp yêu cầu. Container truy cập đúng nơi (/workspace), sửa file, và commit back để repo luôn có copyright cho mọi commit sau. Không commit → chỉ fix tạm thời cho build này.

  • ❌ [SAI] Build a new Docker container that examines the files in /workspace and then checks and adds a copyright for each source file. Changed files do not need to be committed back to the source repository.
    Sai vì không commit back: File chỉ được sửa trong /workspace của build hiện tại (volatile). Các bước sau dùng được, nhưng repo gốc không thay đổi → commit tiếp theo vẫn fail validation, không enforce policy. Cloud Build không tự động persist thay đổi repo.

  • ❌ [SAI] Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are written back to the Cloud Storage bucket.
    Sai vì Cloud Storage bucket không phải nơi chứa source: Cloud Build checkout từ repo Git vào /workspace, không dùng GS bucket trực tiếp cho source (trừ legacy hoặc manual upload). Không khớp trigger "source commit". Write back bucket chỉ lưu artifact, không update repo.

  • ❌ [SAI] Build a new Docker container that examines the files in a Cloud Storage bucket and then checks and adds a copyright for each source file. Changed files are explicitly committed back to the source repository.
    Sai tương tự phương án 3: /workspace mới đúng, không phải GS bucket. Commit back từ bucket không logic (bucket không phải Git repo), gây confusion và fail vì source ở repo Git.

📚 Tài liệu tham khảo (cập nhật 2026)

Hy vọng phân tích rõ ràng! 🚀 Nếu cần code sample cloudbuild.yaml hoặc Docker script, hỏi thêm nhé!

Câu 166
One of your deployed applications in Google Kubernetes Engine (GKE) is having intermittent performance issues. Your team uses a third-party logging solution. You want to install this solution on each node in your GKE cluster so you can view the logs. What should you do?
  1. A Deploy the third-party solution as a DaemonSet
  2. B Modify your container image to include the monitoring software
  3. C Use SSH to connect to the GKE node, and install the software manually
  4. D Deploy the third-party solution using Terraform and deploy the logging Pod as a Kubernetes Deployment
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả một tình huống thực tế trong Google Kubernetes Engine (GKE): Một ứng dụng đã triển khai đang gặp vấn đề hiệu suất không ổn định (intermittent performance issues). Đội ngũ sử dụng giải pháp logging bên thứ ba và muốn cài đặt giải pháp này trên mỗi node (mỗi máy ảo) trong cluster GKE để có thể xem logs.

📌 Mục tiêu chính: Cần một cách triển khai logging agent sao cho nó chạy trên mọi node một cách tự động, đáng tin cậy, phù hợp với Kubernetes best practices. Đây là vấn đề phổ biến khi cần thu thập logs từ hệ thống (node-level logs) thay vì chỉ từ container cụ thể. GKE sử dụng Kubernetes core concepts, và giải pháp phải tận dụng các Kubernetes resources để đảm bảo tính mở rộng (scalability) và tự động hóa.

🛠️ Bối cảnh kỹ thuật: Trong GKE (phiên bản mới nhất đến 2026, hỗ trợ Kubernetes 1.29+), nodes có thể scale up/down động, nên phương pháp triển khai phải node-affine (chạy đúng một instance trên mỗi node). Không nên can thiệp thủ công vào nodes vì chúng là managed và có thể bị thay thế.

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Deploy the third-party solution as a DaemonSet

Lý do chi tiết:
DaemonSet là Kubernetes resource lý tưởng để chạy một pod (chứa logging agent) trên mỗi node trong cluster. Khi node mới được thêm vào hoặc node cũ bị xóa, DaemonSet sẽ tự động schedule pod mới tương ứng. Điều này hoàn hảo cho logging solutions (như Fluentd, Filebeat) cần thu thập logs từ toàn bộ node. Trong GKE, DaemonSet được hỗ trợ đầy đủ, dễ deploy qua kubectl apply -f daemonset.yaml, và tích hợp tốt với GKE logging (nhưng ở đây dùng third-party). Theo docs Kubernetes/GKE 2026, DaemonSet đảm bảo high availability và zero-downtime cho node-level agents. ✅ Best practice chính thức!

📋 Giải thích tất cả các phương án (đúng/sai)

Dưới đây là phân tích từng lựa chọn, giữ nguyên nội dung gốc bằng tiếng Anh, kèm giải thích hoàn toàn bằng tiếng Việt với lý do đúng/sai:

  • ✅ Deploy the third-party solution as a DaemonSet
    🟢 Đúng: Như đã giải thích ở trên, DaemonSet đảm bảo logging agent chạy chính xác một pod trên mỗi node, tự động scale theo cluster. Đây là cách chuẩn cho các agent như monitoring/logging (ví dụ: official Fluentd DaemonSet trong GKE docs). Không cần can thiệp thủ công, phù hợp với managed cluster.

  • ❌ Modify your container image to include the monitoring software
    🔴 Sai: Việc sửa đổi container image của ứng dụng chính để nhúng logging software chỉ ảnh hưởng đến pods của ứng dụng đó, không chạy trên mỗi node (bao gồm cả hệ thống logs ngoài app). Điều này làm image bloated, khó maintain, và không giải quyết logs node-level. Không phải cách deploy agent toàn cluster.

  • ❌ Use SSH to connect to the GKE node, and install the software manually
    🔴 Sai: GKE là managed service, nodes không khuyến khích SSH thủ công (cần disable autopilot hoặc dùng node pools đặc biệt). Cài đặt manual không tự động, dễ mất dữ liệu khi node recreate/scale, vi phạm immutable infrastructure principle. GKE docs cấm cách này vì không scalable và bảo mật kém.

  • ❌ Deploy the third-party solution using Terraform and deploy the logging Pod as a Kubernetes Deployment
    🔴 Sai: Terraform chỉ là IaC tool để provision, nhưng Deployment schedule pods dựa trên replicas, không đảm bảo một pod per node (có thể multiple pods trên một node hoặc thiếu node nào đó). Không phù hợp cho node-level tasks; DaemonSet mới là lựa chọn đúng. Terraform có thể dùng để deploy DaemonSet, nhưng Deployment thì sai.

📘 Tài liệu tham khảo (cập nhật đến 2026)

  • Kubernetes Docs: DaemonSets – "DaemonSet ensures that a copy of the pod is running on all (or some) nodes."
  • GKE Docs: Running logging agents on GKE – Khuyến nghị DaemonSet cho third-party logging như Fluent Bit.
  • Best Practices: Google Cloud Skills Boost (Professional Cloud Developer cert) – Module GKE workloads, nhấn mạnh DaemonSet cho node agents.
  • Phiên bản mới: Kubernetes 1.30+ (GKE standard 2026) hỗ trợ DaemonSet với node affinity/taints tốt hơn cho Autopilot clusters.

Hy vọng phân tích này giúp bạn nắm vững! 🚀 Nếu cần ví dụ YAML DaemonSet, hãy hỏi thêm nhé!

Câu 167
Case study -

This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided.

To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study.

At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section.


To start the case study -
To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment, and problem statements. If the case study has an All Information tab, note that the information displayed is identical to the information displayed on the subsequent tabs. When you are ready to answer a question, click the Question button to return to the question.


Company Overview -
HipLocal is a community application designed to facilitate communication between people in close proximity. It is used for event planning and organizing sporting events, and for businesses to connect with their local communities. HipLocal launched recently in a few neighborhoods in Dallas and is rapidly growing into a global phenomenon. Its unique style of hyper-local community communication and business outreach is in demand around the world.


Executive Statement -
We are the number one local community app; it's time to take our local community services global. Our venture capital investors want to see rapid growth and the same great experience for new local and virtual communities that come online, whether their members are 10 or 10000 miles away from each other.


Solution Concept -
HipLocal wants to expand their existing service, with updated functionality, in new regions to better serve their global customers. They want to hire and train a new team to support these regions in their time zones. They will need to ensure that the application scales smoothly and provides clear uptime data, and that they analyze and respond to any issues that occur.


Existing Technical Environment -
HipLocal's environment is a mix of on-premises hardware and infrastructure running in Google Cloud Platform. The HipLocal team understands their application well, but has limited experience in global scale applications. Their existing technical environment is as follows:
• Existing APIs run on Compute Engine virtual machine instances hosted in GCP.
• State is stored in a single instance MySQL database in GCP.
• Release cycles include development freezes to allow for QA testing.
• The application has no logging.
• Applications are manually deployed by infrastructure engineers during periods of slow traffic on weekday evenings.
• There are basic indicators of uptime; alerts are frequently fired when the APIs are unresponsive.


Business Requirements -
HipLocal's investors want to expand their footprint and support the increase in demand they are seeing. Their requirements are:
• Expand availability of the application to new regions.
• Support 10x as many concurrent users.
• Ensure a consistent experience for users when they travel to different regions.
• Obtain user activity metrics to better understand how to monetize their product.
• Ensure compliance with regulations in the new regions (for example, GDPR).
• Reduce infrastructure management time and cost.
• Adopt the Google-recommended practices for cloud computing.
○ Develop standardized workflows and processes around application lifecycle management.
○ Define service level indicators (SLIs) and service level objectives (SLOs).


Technical Requirements -
• Provide secure communications between the on-premises data center and cloud-hosted applications and infrastructure.
• The application must provide usage metrics and monitoring.
• APIs require authentication and authorization.
• Implement faster and more accurate validation of new features.
• Logging and performance metrics must provide actionable information to be able to provide debugging information and alerts.
• Must scale to meet user demand.


For this question, refer to the HipLocal case study.

How should HipLocal redesign their architecture to ensure that the application scales to support a large increase in users?
  1. A Use Google Kubernetes Engine (GKE) to run the application as a microservice. Run the MySQL database on a dedicated GKE node.
  2. B Use multiple Compute Engine instances to run MySQL to store state information. Use a Google Cloud-managed load balancer to distribute the load between instances. Use managed instance groups for scaling.
  3. C Use Memorystore to store session information and CloudSQL to store state information. Use a Google Cloud-managed load balancer to distribute the load between instances. Use managed instance groups for scaling.
  4. D Use a Cloud Storage bucket to serve the application as a static website, and use another Cloud Storage bucket to store user state information.
Xem giải thích

🧩 Phân tích nội dung câu hỏi

Câu hỏi thuộc case study HipLocal – một ứng dụng cộng đồng hyper-local đang mở rộng toàn cầu, với yêu cầu scale ứng dụng để hỗ trợ tăng 10x concurrent users, đảm bảo consistent experience giữa các vùng, giảm thời gian quản lý hạ tầng, tuân thủ Google-recommended practices (như SLIs/SLOs, lifecycle management), cung cấp metrics/monitoring/logging, và scale theo demand.

Hiện tại, kiến trúc cũ có hạn chế lớn:

  • APIs chạy trên Compute Engine VM instances (không auto-scale).
  • Single-instance MySQL lưu state (dễ single point of failure, không HA).
  • Không logging, deploy thủ công, alert thường xuyên khi unresponsive.

Mục tiêu redesign: Cần kiến trúc horizontal scaling, managed services để giảm ops, hỗ trợ multi-region, secure/auth, và metrics actionable. Câu hỏi tập trung vào scale lớn users bằng cách tối ưu app servers, session/state storage.

📘 Tài liệu tham khảo:

✅ Đáp án đúng & Lý do lựa chọn

Đáp án đúng: Use Memorystore to store session information and CloudSQL to store state information. Use a Google Cloud-managed load balancer to distribute the load between instances. Use managed instance groups for scaling.

Lý do chọn 🛠️:

  • Memorystore (managed Redis/Memcached) lưu session info (nhanh, in-memory, auto-scale, low-latency cho concurrent users cao, hỗ trợ multi-zone/replication).
  • CloudSQL (managed MySQL) lưu state info (HA với failover tự động, read replicas scale reads, backup tự động, phù hợp single-tenant DB hiện tại mà không cần migrate lớn).
  • Google Cloud-managed load balancer (HTTP(S)/TCP) phân tải đều, health checks, global/multi-region.
  • Managed Instance Groups (MIGs) trên Compute Engine: Auto-scale dựa trên CPU/load/metrics, rolling updates, self-healing – lý tưởng cho APIs stateful/stateless, giảm manual deploy.
  • Toàn bộ managed → Giảm infra mgmt, tích hợp Monitoring/Logging (Cloud Operations), hỗ trợ 10x users, consistent experience, align Google best practices (SLIs như latency/uptime).

📋 Giải thích tất cả các phương án

Dưới đây là phân tích từng phương án (giữ nguyên text gốc tiếng Anh), đánh dấu đúng/sai với lý do chi tiết:

  • Use Google Kubernetes Engine (GKE) to run the application as a microservice. Run the MySQL database on a dedicated GKE node.
    ❌ Sai 🛠️: GKE tốt cho microservices/orchestration (Autopilot mode mới 2024+ auto-manage), nhưng HipLocal limited experience global scale → Overhead học Kubernetes cao (vs. MIG đơn giản hơn). Chạy MySQL trên GKE node không managed, dễ OOM/single failure, vi phạm HA/scale DB (không auto-backup/replicas như CloudSQL). Không giải quyết logging/metrics ngay, tăng complexity ops thay vì giảm.

  • Use multiple Compute Engine instances to run MySQL to store state information. Use a Google Cloud-managed load balancer to distribute the load between instances. Use managed instance groups for scaling.
    ❌ Sai 🧩: MIG + load balancer tốt cho app instances scale, nhưng multiple CE cho MySQL kém: MySQL không dễ cluster horizontal (cần setup master-slave thủ công, replication lag, failover phức tạp). Không managed → Tăng mgmt time/cost (patching/backup), không HA tự động, dễ downtime (vi phạm req consistent experience/uptime data). Không tách session/state → Bottleneck DB cho 10x users.

  • Use Memorystore to store session information and CloudSQL to store state information. Use a Google Cloud-managed load balancer to distribute the load between instances. Use managed instance groups for scaling.
    ✅ Đúng 🌟: Như lý do trên – Tách session (transient, Memorystore fast/temporary) vs. state (persistent, CloudSQL scalable/HA) → App stateless hơn, scale dễ (MIG handle app load). Load balancer + MIG = Horizontal scale seamless, metrics qua Cloud Monitoring. Hỗ trợ multi-region (CloudSQL cross-region replicas), giảm cost/op, full Google practices. Phù hợp migrate dần từ existing CE/MySQL.

  • Use a Cloud Storage bucket to serve the application as a static website, and use another Cloud Storage bucket to store user state information.
    ❌ Sai 📦: Cloud Storage chỉ cho static content (cheap/global CDN), không chạy APIs dynamic (cần compute cho logic/auth/processing). Lưu state ở bucket không phù hợp (object storage không queryable/transactional như DB, consistency eventual, không real-time scale). Không scale concurrent users, thiếu auth/secure comm, hoàn toàn lệch req (APIs, metrics, validation features).

Câu 168
Case study -

This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided.

To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study.

At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section.


To start the case study -
To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment, and problem statements. If the case study has an All Information tab, note that the information displayed is identical to the information displayed on the subsequent tabs. When you are ready to answer a question, click the Question button to return to the question.


Company Overview -
HipLocal is a community application designed to facilitate communication between people in close proximity. It is used for event planning and organizing sporting events, and for businesses to connect with their local communities. HipLocal launched recently in a few neighborhoods in Dallas and is rapidly growing into a global phenomenon. Its unique style of hyper-local community communication and business outreach is in demand around the world.


Executive Statement -
We are the number one local community app; it's time to take our local community services global. Our venture capital investors want to see rapid growth and the same great experience for new local and virtual communities that come online, whether their members are 10 or 10000 miles away from each other.


Solution Concept -
HipLocal wants to expand their existing service, with updated functionality, in new regions to better serve their global customers. They want to hire and train a new team to support these regions in their time zones. They will need to ensure that the application scales smoothly and provides clear uptime data, and that they analyze and respond to any issues that occur.


Existing Technical Environment -
HipLocal's environment is a mix of on-premises hardware and infrastructure running in Google Cloud Platform. The HipLocal team understands their application well, but has limited experience in global scale applications. Their existing technical environment is as follows:
• Existing APIs run on Compute Engine virtual machine instances hosted in GCP.
• State is stored in a single instance MySQL database in GCP.
• Release cycles include development freezes to allow for QA testing.
• The application has no logging.
• Applications are manually deployed by infrastructure engineers during periods of slow traffic on weekday evenings.
• There are basic indicators of uptime; alerts are frequently fired when the APIs are unresponsive.


Business Requirements -
HipLocal's investors want to expand their footprint and support the increase in demand they are seeing. Their requirements are:
• Expand availability of the application to new regions.
• Support 10x as many concurrent users.
• Ensure a consistent experience for users when they travel to different regions.
• Obtain user activity metrics to better understand how to monetize their product.
• Ensure compliance with regulations in the new regions (for example, GDPR).
• Reduce infrastructure management time and cost.
• Adopt the Google-recommended practices for cloud computing.
○ Develop standardized workflows and processes around application lifecycle management.
○ Define service level indicators (SLIs) and service level objectives (SLOs).


Technical Requirements -
• Provide secure communications between the on-premises data center and cloud-hosted applications and infrastructure.
• The application must provide usage metrics and monitoring.
• APIs require authentication and authorization.
• Implement faster and more accurate validation of new features.
• Logging and performance metrics must provide actionable information to be able to provide debugging information and alerts.
• Must scale to meet user demand.


For this question, refer to the HipLocal case study.

How should HipLocal increase their API development speed while continuing to provide the QA team with a stable testing environment that meets feature requirements?
  1. A Include unit tests in their code, and prevent deployments to QA until all tests have a passing status.
  2. B Include performance tests in their code, and prevent deployments to QA until all tests have a passing status.
  3. C Create health checks for the QA environment, and redeploy the APIs at a later time if the environment is unhealthy.
  4. D Redeploy the APIs to App Engine using Traffic Splitting. Do not move QA traffic to the new versions if errors are found.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

✅ Giải thích câu hỏi:
Câu hỏi thuộc case study HipLocal – một ứng dụng cộng đồng hyper-local đang mở rộng toàn cầu trên Google Cloud Platform (GCP). Hiện tại, môi trường kỹ thuật của họ có các vấn đề như: API chạy trên Compute Engine VM, không có logging, deploy thủ công vào giờ thấp điểm, release cycles có freeze phát triển để QA test, và thiếu chỉ số uptime rõ ràng.
Mục tiêu chính: Tăng tốc độ phát triển API (API development speed) đồng thời đảm bảo môi trường QA (Quality Assurance) ổn định, đáp ứng đầy đủ yêu cầu tính năng (feature requirements).
Điều này phù hợp với Business Requirements (giảm thời gian quản lý infra, áp dụng best practices GCP như standardized workflows cho lifecycle management, định nghĩa SLIs/SLOs) và Technical Requirements (triển khai validation nhanh hơn cho tính năng mới, logging/performance metrics actionable).
HipLocal cần giải pháp tự động hóa kiểm thử sớm để dev nhanh hơn mà không làm QA bị ảnh hưởng bởi code lỗi, tránh freeze cycles dài và deploy thủ công. (Kiến thức GCP cập nhật 2026: Áp dụng CI/CD pipelines với testing gates theo Google-recommended practices trong Cloud Build và Artifact Registry).

📘 Nguồn tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Include unit tests in their code, and prevent deployments to QA until all tests have a passing status.

🛠️ Lý do chi tiết:

  • Tăng dev speed: Unit tests (kiểm thử đơn vị) được tích hợp trực tiếp vào code (shift-left testing), chạy tự động trong CI/CD pipeline (ví dụ: Cloud Build triggers). Dev có feedback ngay lập tức, giảm thời gian debug và tránh freeze cycles.
  • QA stable: Gate (cửa kiểm soát) ngăn deploy sang QA nếu test fail → QA chỉ nhận code đã pass unit tests cơ bản, đảm bảo môi trường ổn định và tập trung test integration/end-to-end cho feature requirements.
  • Phù hợp GCP best practices: Áp dụng Testing on the Toilet (Google's testing culture), giảm manual deploy, hỗ trợ scale 10x users và faster validation. Không ảnh hưởng uptime hay regions mới.
    (Kiến thức 2026: Tích hợp với Firebase Test Lab hoặc AlloyDB cho stateful tests, nhưng unit tests là nền tảng).

❌ Phân tích tất cả các phương án

  • Include unit tests in their code, and prevent deployments to QA until all tests have a passing status.
    ✅ Đúng (như giải thích trên): Tích hợp unit tests vào code với deployment gate là giải pháp tối ưu, tự động hóa sớm, tăng speed dev mà giữ QA clean và feature-complete. Giảm rủi ro từ code lỗi lan sang QA.

  • Include performance tests in their code, and prevent deployments to QA until all tests have a passing status.
    ❌ Sai: Performance tests (kiểm thử hiệu suất) tập trung vào load/scalability (ví dụ: dưới 10x users), không phải validation feature requirements cơ bản. Chạy performance sớm làm chậm dev cycle (tốn tài nguyên), không giải quyết vấn đề chính là stable QA cho tính năng mới. Phù hợp hơn cho prod monitoring (Cloud Monitoring), không phải gate QA.

  • Create health checks for the QA environment, and redeploy the APIs at a later time if the environment is unhealthy.
    ❌ Sai: Health checks (kiểm tra sức khỏe, ví dụ: Load Balancer health checks) chỉ phát hiện vấn đề sau deploy (reactive), không ngăn code xấu vào QA → không tăng dev speed, vẫn cần manual redeploy (giống hiện tại). Không đảm bảo feature requirements stable từ đầu, chỉ fix symptoms chứ không cure root cause.

  • Redeploy the APIs to App Engine using Traffic Splitting. Do not move QA traffic to the new versions if errors are found.
    ❌ Sai: Traffic Splitting (chia traffic phiên bản trên App Engine, cập nhật 2025 với gradual rollout) lý tưởng cho production canary releases để test new versions an toàn, không phải QA environment. QA cần full feature testing, không phải traffic-based; migrate từ Compute Engine sang App Engine cần refactor lớn, không trực tiếp tăng dev speed hay ổn định QA ngay lập tức. (Phù hợp Technical Req secure comms, nhưng lệch câu hỏi).

Câu 169
Case study -

This is a case study. Case studies are not timed separately. You can use as much exam time as you would like to complete each case. However, there may be additional case studies and sections on this exam. You must manage your time to ensure that you are able to complete all questions included on this exam in the time provided.

To answer the questions included in a case study, you will need to reference information that is provided in the case study. Case studies might contain exhibits and other resources that provide more information about the scenario that is described in the case study. Each question is independent of the other questions in this case study.

At the end of this case study, a review screen will appear. This screen allows you to review your answers and to make changes before you move to the next section of the exam. After you begin a new section, you cannot return to this section.


To start the case study -
To display the first question in this case study, click the Next button. Use the buttons in the left pane to explore the content of the case study before you answer the questions. Clicking these buttons displays information such as business requirements, existing environment, and problem statements. If the case study has an All Information tab, note that the information displayed is identical to the information displayed on the subsequent tabs. When you are ready to answer a question, click the Question button to return to the question.


Company Overview -
HipLocal is a community application designed to facilitate communication between people in close proximity. It is used for event planning and organizing sporting events, and for businesses to connect with their local communities. HipLocal launched recently in a few neighborhoods in Dallas and is rapidly growing into a global phenomenon. Its unique style of hyper-local community communication and business outreach is in demand around the world.


Executive Statement -
We are the number one local community app; it's time to take our local community services global. Our venture capital investors want to see rapid growth and the same great experience for new local and virtual communities that come online, whether their members are 10 or 10000 miles away from each other.


Solution Concept -
HipLocal wants to expand their existing service, with updated functionality, in new regions to better serve their global customers. They want to hire and train a new team to support these regions in their time zones. They will need to ensure that the application scales smoothly and provides clear uptime data, and that they analyze and respond to any issues that occur.


Existing Technical Environment -
HipLocal's environment is a mix of on-premises hardware and infrastructure running in Google Cloud Platform. The HipLocal team understands their application well, but has limited experience in global scale applications. Their existing technical environment is as follows:
• Existing APIs run on Compute Engine virtual machine instances hosted in GCP.
• State is stored in a single instance MySQL database in GCP.
• Release cycles include development freezes to allow for QA testing.
• The application has no logging.
• Applications are manually deployed by infrastructure engineers during periods of slow traffic on weekday evenings.
• There are basic indicators of uptime; alerts are frequently fired when the APIs are unresponsive.


Business Requirements -
HipLocal's investors want to expand their footprint and support the increase in demand they are seeing. Their requirements are:
• Expand availability of the application to new regions.
• Support 10x as many concurrent users.
• Ensure a consistent experience for users when they travel to different regions.
• Obtain user activity metrics to better understand how to monetize their product.
• Ensure compliance with regulations in the new regions (for example, GDPR).
• Reduce infrastructure management time and cost.
• Adopt the Google-recommended practices for cloud computing.
○ Develop standardized workflows and processes around application lifecycle management.
○ Define service level indicators (SLIs) and service level objectives (SLOs).


Technical Requirements -
• Provide secure communications between the on-premises data center and cloud-hosted applications and infrastructure.
• The application must provide usage metrics and monitoring.
• APIs require authentication and authorization.
• Implement faster and more accurate validation of new features.
• Logging and performance metrics must provide actionable information to be able to provide debugging information and alerts.
• Must scale to meet user demand.


For this question, refer to the HipLocal case study.

HipLocal's application uses Cloud Client Libraries to interact with Google Cloud. HipLocal needs to configure authentication and authorization in the Cloud Client Libraries to implement least privileged access for the application. What should they do?
  1. A Create an API key. Use the API key to interact with Google Cloud.
  2. B Use the default compute service account to interact with Google Cloud.
  3. C Create a service account for the application. Export and deploy the private key for the application. Use the service account to interact with Google Cloud.
  4. D Create a service account for the application and for each Google Cloud API used by the application. Export and deploy the private keys used by the application. Use the service account with one Google Cloud API to interact with Google Cloud.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi thuộc case study HipLocal – một ứng dụng cộng đồng trên Google Cloud Platform (GCP), đang mở rộng toàn cầu với yêu cầu về bảo mật, mở rộng quy mô và tuân thủ (như GDPR). Ứng dụng hiện chạy API trên Compute Engine, lưu trạng thái trên MySQL, thiếu logging và metrics.

Tập trung vấn đề: HipLocal sử dụng Cloud Client Libraries (thư viện client của GCP để tương tác với các dịch vụ như Compute Engine, Storage, v.v.) và cần cấu hình xác thực (authentication) + ủy quyền (authorization) theo nguyên tắc least privilege access (quyền hạn tối thiểu, chỉ cấp quyền cần thiết để tránh rủi ro bảo mật).

Mục tiêu: Đảm bảo ứng dụng tương tác an toàn với GCP mà không cấp quyền thừa, phù hợp với Technical Requirements (secure communications, APIs cần auth/authz) và Google-recommended practices (SLOs, lifecycle management).

Câu hỏi yêu cầu chọn cách tối ưu nhất để cấu hình auth cho Cloud Client Libraries trong môi trường này (mix on-prem và GCP). ✅ Kiến thức cập nhật GCP 2026: Theo docs GCP mới nhất (IAM v2, Workload Identity Federation ưu tiên cho VM, nhưng cho client libs trên app/server-side vẫn khuyến nghị Service Account key với rotation tự động via Metadata).

📘 Tài liệu tham khảo:

✅ Đáp án đúng và lý do lựa chọn

Đáp án đúng: Create a service account for the application. Export and deploy the private key for the application. Use the service account to interact with Google Cloud.

Lý do 🛠️:

  • Đây là cách chuẩn GCP cho Cloud Client Libraries (như Python/Java SDK) để auth server-side app theo least privilege. Tạo Service Account (SA) dành riêng cho app, gán IAM roles tối thiểu (ví dụ: roles/storage.objectViewer nếu chỉ đọc Storage). Export JSON private key → deploy an toàn vào app (env var hoặc secret manager), libs tự detect và dùng để sign JWT/OAuth2 token.
  • Phù hợp HipLocal: App trên Compute Engine/on-prem cần auth cross-service; tránh quyền rộng. Hỗ trợ metrics/monitoring qua IAM audit logs.
  • Ưu điểm: Scale tốt, dễ audit, tuân thủ GDPR (key rotation via gcloud hoặc Secret Manager). Không vi phạm release cycles thủ công.

📋 Giải thích tất cả các phương án (đúng/sai)

  • ❌ [SAI] Create an API key. Use the API key to interact with Google Cloud.
    Phương án này sai hoàn toàn vì API key chỉ dùng cho public APIs đơn giản (như Maps/YouTube), KHÔNG hỗ trợ OAuth2 cho Cloud Client Libraries. Key dễ lộ (không mã hóa), không enforce least privilege (quyền toàn cục), và bị deprecated cho server-side từ 2023. HipLocal cần secure auth cho APIs nội bộ → rủi ro cao, không scale.

  • ❌ [SAI] Use the default compute service account to interact with Google Cloud.
    Sai vì default Compute Engine SA (project-owned) có quyền quá rộng (Editor roles mặc định), vi phạm least privilege. Dễ bị exploit nếu VM compromise. GCP khuyến cáo tắt default SA từ 2024 và dùng custom SA với impersonation. HipLocal thiếu kinh nghiệm global scale → cần custom để audit/comply.

  • ✅ [ĐÚNG] Create a service account for the application. Export and deploy the private key for the application. Use the service account to interact with Google Cloud.
    Đúng 100% như giải thích trên. Best practice: Một SA duy nhất cho app, gán roles granular (least privilege), key JSON deploy qua Config Connector/Secret Manager. Client libs auto-use (GOOGLE_APPLICATION_CREDENTIALS env). Scale 10x users, hỗ trợ metrics/alerts.

  • ❌ [SAI] Create a service account for the application and for each Google Cloud API used by the application. Export and deploy the private keys used by the application. Use the service account with one Google Cloud API to interact with Google Cloud.
    Sai và phức tạp hóa: Không cần nhiều SA riêng cho từng API (overkill, khó manage). GCP khuyến nghị một SA + multiple IAM bindings (roles/compute.admin + storage.admin). Deploy nhiều key tăng rủi ro lộ key, vi phạm "reduce infrastructure management time". Câu cuối "use SA with one API" mâu thuẫn, không logic cho multi-service.

🧠 Kết luận: Lựa chọn đúng giúp HipLocal chuyển sang managed auth, tích hợp monitoring (Cloud Logging/Monitoring), sẵn sàng global expand! 🚀

Câu 170
You are in the final stage of migrating an on-premises data center to Google Cloud. You are quickly approaching your deadline, and discover that a web API is running on a server slated for decommissioning. You need to recommend a solution to modernize this API while migrating to Google Cloud. The modernized web API must meet the following requirements:

• Autoscales during high traffic periods at the end of each month
• Written in Python 3.x
• Developers must be able to rapidly deploy new versions in response to frequent code changes

You want to minimize cost, effort, and operational overhead of this migration. What should you do?
  1. A Modernize and deploy the code on App Engine flexible environment.
  2. B Modernize and deploy the code on App Engine standard environment.
  3. C Deploy the modernized application to an n1-standard-1 Compute Engine instance.
  4. D Ask the development team to re-write the application to run as a Docker container on Google Kubernetes Engine.
Xem giải thích

🧩 Phân tích chi tiết nội dung câu hỏi

Câu hỏi mô tả tình huống bạn đang ở giai đoạn cuối cùng của việc di chuyển data center on-premises sang Google Cloud, với thời hạn sắp hết. Bạn phát hiện một web API đang chạy trên server sắp bị loại bỏ (decommission). Nhiệm vụ là đề xuất giải pháp modernize (hiện đại hóa) API này trong quá trình migrate sang Google Cloud, đồng thời đáp ứng các yêu cầu cụ thể:

  • Autoscales (tự động scale) trong các khoảng cao điểm traffic vào cuối mỗi tháng 📈.
  • Được viết bằng Python 3.x 🐍.
  • Developers có thể deploy phiên bản mới nhanh chóng để ứng phó với các thay đổi code thường xuyên ⚡.

Mục tiêu chính: Tối thiểu hóa chi phí, công sức (effort) và overhead vận hành (operational overhead) 💰🛠️. Đây là câu hỏi kiểm tra kiến thức về các dịch vụ serverless trên Google Cloud, ưu tiên giải pháp dễ dàng, tự động hóa cao cho ứng dụng Python web API nhỏ gọn.

Kiến thức cập nhật (đến 2026): App Engine Standard hỗ trợ Python 3.9, 3.10, 3.11, 3.12 (runtime mới nhất theo docs Google Cloud 2024-2026), với autoscaling miễn phí, deploy zero-downtime qua gcloud app deploy. Không liên quan AWS như đề cập (có thể nhầm lẫn), tập trung Google Cloud.

✅ Đáp án đúng và lý do lựa chọn

Modernize and deploy the code on App Engine standard environment.

Lý do:

  • App Engine Standard là môi trường serverless thuần túy, lý tưởng cho Python 3.x (sandboxed runtime, hỗ trợ Flask/FastAPI/Django nhanh chóng) 🐍.
  • Autoscaling tự động: Scale từ 0 đến hàng nghìn instances trong cao điểm cuối tháng, chỉ tính phí theo usage (free tier cho low traffic) 📈💸.
  • Deploy nhanh: Chỉ cần gcloud app deploy với traffic splitting (blue-green deploy), hỗ trợ CI/CD tự động cho frequent changes, zero ops overhead 👨‍💻.
  • Minimize cost/effort: Không quản lý server/Docker, migrate nhanh từ on-prem code Python thuần, chi phí thấp nhất (~$0.05/100k requests) so với các option khác.

📋 Giải thích tất cả các phương án (đúng/sai)

  • ✅ Modernize and deploy the code on App Engine standard environment.
    Đúng vì như phân tích trên: Hoàn hảo khớp yêu cầu Python 3.x, autoscaling miễn phí, deploy siêu nhanh (seconds), serverless 100% giảm overhead tối đa. Lý tưởng cho web API nhỏ, migrate nhanh trước deadline ⏰.

  • ❌ Modernize and deploy the code on App Engine flexible environment.
    Sai vì Flexible environment chạy trên GCE VMs (dùng Docker), yêu cầu container hóa code, overhead cao hơn (quản lý VM, custom runtime), chi phí đắt hơn (~2-3x Standard do always-on VMs), autoscaling kém linh hoạt hơn cho traffic bursty. Không minimize effort cho Python thuần 🛠️🚫.

  • ❌ Deploy the modernized application to an n1-standard-1 Compute Engine instance.
    Sai vì Compute Engine là VM manual management, phải tự config autoscaling (MIG/ASG), install Python/runtime, setup load balancer/HTTPS. Overhead vận hành cao (patching, monitoring), chi phí fixed (~$20/tháng cho n1-standard-1), không phù hợp frequent deploys hay burst traffic. Không serverless 💻❌.

  • ❌ Ask the development team to re-write the application to run as a Docker container on Google Kubernetes Engine.
    Sai vì yêu cầu rewrite sang Docker (effort lớn, thời gian dài trước deadline), GKE cần quản lý cluster/pods/Helm, autoscaling phức tạp (HPA), chi phí cao (cluster fee + nodes). Overhead ops khổng lồ cho web API đơn giản, vi phạm minimize effort 🚀🚫.

📘 Tài liệu tham khảo

Giải pháp này giúp hoàn thành migration nhanh chóng, tiết kiệm! 🚀 Nếu cần demo code hoặc lab, hỏi thêm nhé! 😊