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

Tìm thấy 358 câu.

Câu 331
You are developing a new ecommerce website for your company. You want customers to receive a customized email notification when they place an order. You need to configure this email service while minimizing deployment effort. What should you do?
  1. A Create a Cloud Function that is triggered by a create type event in Firestore,
  2. B Create an email-sending application hosted on Compute Engine that is invoked by an HTTP request.
  3. C Create an email notification channel, and set up an alerting policy that is based on log metrics from a create type event.
  4. D Use Pub/Sub to send an email when the orders/ API returns an HTTP response of 200 OK.
Xem giải thích

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

Câu hỏi mô tả tình huống phát triển một website thương mại điện tử (ecommerce) mới cho công ty. Yêu cầu chính là gửi thông báo email tùy chỉnh (customized email notification) cho khách hàng ngay khi họ đặt hàng (place an order). Đồng thời, cần cấu hình dịch vụ email này với nỗ lực triển khai tối thiểu (minimizing deployment effort).

🛠️ Chi tiết ngữ cảnh:

  • Giả sử đơn hàng (order) được lưu trữ trong Firestore (cơ sở dữ liệu NoSQL serverless của Google Cloud).
  • Cần một giải pháp event-driven (kích hoạt bởi sự kiện), tự động, không cần quản lý server để giảm công sức triển khai.
  • Mục tiêu: Serverless, scalable, dễ tích hợp với email service như SendGrid, Mailgun hoặc Cloud Functions + SMTP.

Đây là câu hỏi điển hình về serverless architecture trên Google Cloud Platform (GCP), tập trung vào Cloud Functions làm trigger handler cho sự kiện database.

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

Đáp án đúng: Create a Cloud Function that is triggered by a create type event in Firestore.

Lý do (🧩 Phân tích chi tiết):

  • Cloud Functions là dịch vụ serverless, tự động scale, không cần quản lý infrastructure → tối ưu hóa deployment effort.
  • Trigger "create type event" trên Firestore sẽ kích hoạt ngay khi document order mới được tạo (ví dụ: collection orders có document mới).
  • Trong function, dễ dàng gửi email tùy chỉnh bằng thư viện như Nodemailer hoặc tích hợp Cloud Pub/Sub + Send Email.
  • Ưu điểm: Zero provisioning, pay-per-use, tích hợp native với Firestore (hỗ trợ đến phiên bản mới nhất 2026 với Cloud Functions Gen 2).
  • Đây là best practice cho event-driven email notifications trong GCP ecommerce apps.

📋 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 (giữ nguyên văn bản gốc tiếng Anh). Mỗi phương án được đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm lý do chi tiết bằng tiếng Việt:

  • ✅ Create a Cloud Function that is triggered by a create type event in Firestore
    Đúng vì: Giải pháp serverless hoàn hảo, trigger trực tiếp từ sự kiện onCreate của Firestore document (order mới). Deployment chỉ cần 1 lệnh gcloud functions deploy, không server management. Hỗ trợ customize email dễ dàng (ví dụ: dùng functions.firestore.document('orders/{orderId}').onCreate()). Phù hợp minimizing effort nhất! 🚀

  • ❌ Create an email-sending application hosted on Compute Engine that is invoked by an HTTP request
    Sai vì: Compute Engine yêu cầu tạo VM, cài đặt app, quản lý OS/security patches → deployment effort cao (provisioning, scaling manual). Phải gọi HTTP từ app đặt hàng, không event-driven tự động. Không serverless, tốn chi phí idle time.

  • ❌ Create an email notification channel, and set up an alerting policy that is based on log metrics from a create type event
    Sai vì: Cloud Monitoring Alerting dùng cho monitoring/alert (như downtime), không phải gửi email tùy chỉnh cho từng order. Log-based metrics từ "create event" chỉ đếm sự kiện, không trigger per-event email. Notification channel chỉ gửi alert summary, không customize nội dung order-specific.

  • ❌ Use Pub/Sub to send an email when the orders/ API returns an HTTP response of 200 OK
    Sai vì: Pub/Sub là message queue, không gửi email trực tiếp (cần subscriber riêng). Trigger từ HTTP 200 OK của API không đảm bảo (API có thể fail sau 200, hoặc không capture order details). Deployment phức tạp hơn (topic + subscription + handler), không minimize effort so với Firestore trigger native.

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

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

Câu 332
You are developing an online chat application where users can upload profile pictures. Uploaded profile pictures must comply with content policies. You need to detect inappropriate images and label those images automatically when they are uploaded. In the future, this process will need to be expanded to include additional processing tasks such as watermarking and image compression.

You want to simplify orchestration and minimize operational overhead of the image scanning and labeling steps while also ensuring that additional steps can be added and removed easily later on. What should you do?
  1. A Save user-uploaded images to a temporary Cloud Storage bucket. Implement code on the backend server to retrieve the image content and call the Vision API to process each new uploaded image.
  2. B Save user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and calls one or more Cloud Run services. Create additional Cloud Run services that call the Vision API to process each new uploaded image.
  3. C Save user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and publishes a message to a Pub/Sub topic. Deploy microservices in GKE that subscribe to the Pub/Sub topic and call the Vision API to process each new uploaded image.
  4. D Save user-uploaded images to a Cloud Storage bucket. Create an Eventarc trigger that connects the bucket to the Workflows event receiver when a new image is uploaded. Create a workflow in Workflows with multiple Cloud Functions that call the Vision API to process each new uploaded image.
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 ứng dụng chat trực tuyến nơi người dùng upload ảnh đại diện (profile pictures). Các ảnh này phải tuân thủ chính sách nội dung, nghĩa là cần phát hiện tự động hình ảnh không phù hợp (inappropriate images) và gán nhãn (label) chúng ngay khi upload. Trong tương lai, quy trình cần mở rộng thêm các bước xử lý như chèn watermark hoặc nén ảnh (image compression).

Yêu cầu chính:

  • Đơn giản hóa orchestration (quản lý luồng công việc).
  • Giảm thiểu operational overhead (chi phí vận hành, quản lý).
  • Dễ dàng thêm/xóa các bước xử lý sau này.

Giải pháp phải dựa trên Google Cloud (GCP), sử dụng Cloud Storage làm nơi lưu ảnh, Vision API để phân tích nội dung, và các dịch vụ serverless/event-driven để xử lý tự động khi có ảnh mới upload. Đây là kịch bản điển hình cho event-driven architecture với khả năng mở rộng linh hoạt. (Kiến thức cập nhật đến 2026: GCP khuyến nghị Eventarc + Workflows cho orchestration serverless, theo tài liệu chính thức GCP 2024-2026).

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

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

Đáp án đúng: Save user-uploaded images to a Cloud Storage bucket. Create an Eventarc trigger that connects the bucket to the Workflows event receiver when a new image is uploaded. Create a workflow in Workflows with multiple Cloud Functions that call the Vision API to process each new uploaded image.

Lý do:
🛠️ Phương án này sử dụng Eventarc (dịch vụ event routing serverless mới nhất của GCP, thay thế Cloud Functions event triggers cũ) để kết nối trực tiếp sự kiện upload từ Cloud Storage đến Workflows. Workflows là công cụ orchestration serverless lý tưởng, cho phép định nghĩa luồng công việc (workflow) dưới dạng YAML với nhiều bước (steps) gọi Cloud Functions (ví dụ: step 1 gọi Vision API detect inappropriate, step 2 label, step 3 watermark sau này).

  • Đơn giản hóa orchestration: Một workflow duy nhất quản lý tất cả, dễ edit YAML để add/remove steps mà không cần deploy lại services.
  • Minimize overhead: Hoàn toàn serverless (không cluster, không backend server), scale tự động, chi phí theo usage.
  • Mở rộng dễ dàng: Thêm steps mới chỉ cần update workflow definition (hỗ trợ đến 2026 với tích hợp Audit Logs và IAM roles linh hoạt).
    Đây là best practice GCP cho scenarios cần multi-step processing từ storage events.

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

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá dựa trên tiêu chí orchestration đơn giản, operational overhead thấp, và dễ mở rộng.

  • [SAI] Save user-uploaded images to a temporary Cloud Storage bucket. Implement code on the backend server to retrieve the image content and call the Vision API to process each new uploaded image.
    ❌ Sai vì: Sử dụng backend server (ví dụ App Engine hoặc Compute Engine) để poll/retrieve ảnh từ bucket – không serverless, yêu cầu quản lý server liên tục (scaling, patching, monitoring). Overhead cao, khó mở rộng thêm steps (phải code cứng vào backend). Không tận dụng event-driven, dễ bottleneck khi traffic cao. Không phù hợp minimize operational overhead.

  • [SAI] Save user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and calls one or more Cloud Run services. Create additional Cloud Run services that call the Vision API to process each new uploaded image.
    ❌ Sai vì: Cloud Function trigger tốt cho event ban đầu, nhưng gọi nhiều Cloud Run services tạo kiến trúc phức tạp (phải deploy/deploy nhiều container, quản lý networking/IAM giữa chúng). Overhead cao khi scale (cold starts Cloud Run, versioning services). Khó orchestration multi-step (add watermark cần thêm service mới, không linh hoạt như workflow). Không đơn giản hóa cho future expansions.

  • [SAI] Save user-uploaded images to a Cloud Storage bucket. Configure a Cloud Function that is triggered when a new image is uploaded and publishes a message to a Pub/Sub topic. Deploy microservices in GKE that subscribe to the Pub/Sub topic and call the Vision API to process each new uploaded image.
    ❌ Sai vì: Sử dụng Pub/Sub + GKE (Kubernetes Engine) cho microservices – operational overhead rất cao (quản lý cluster GKE: nodes, autoscaling, upgrades – tốn kém và phức tạp). Phù hợp high-throughput nhưng overkill cho image processing, khó add/remove steps (phải redeploy pods). Không serverless hoàn toàn, trái với yêu cầu minimize overhead và simplify orchestration.

  • [ĐÚNG] Save user-uploaded images to a Cloud Storage bucket. Create an Eventarc trigger that connects the bucket to the Workflows event receiver when a new image is uploaded. Create a workflow in Workflows with multiple Cloud Functions that call the Vision API to process each new uploaded image.
    ✅ Đúng như đã giải thích ở trên: Serverless end-to-end, orchestration linh hoạt qua Workflows, Eventarc routing đơn giản. Best fit cho yêu cầu! 🚀

Câu 333
You are responsible for improving the security of your Cloud Run services to protect these services against supply chain threats. You need to ensure that there are adequate security controls such as SLSA Level 3 builds for container images and non-falsifiable provenance for container images by using Google Cloud tools. What should you do?
  1. A Ask developers to build container images locally and ensure strict version controls by using Container Registry.
  2. B Use Cloud Build to build container images. Configure a Binary Authorization policy on the Cloud Run job.
  3. C Use Cloud Deploy to generate authenticated and non-falsifiable build provenance for container images.
  4. D Use Cloud Build to build container images. Use Cloud Scheduler to automate delivery of your applications to a series of target environments in a defined sequence.
Xem giải thích

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

Câu hỏi tập trung vào việc cải thiện bảo mật cho các dịch vụ Cloud Run trên Google Cloud Platform (GCP) để chống lại các mối đe dọa chuỗi cung ứng (supply chain threats). Cụ thể, bạn cần triển khai các biện pháp kiểm soát bảo mật đầy đủ như:

  • SLSA Level 3 builds cho container images (SLSA là Supply-chain Levels for Software Artifacts – một framework tiêu chuẩn hóa bảo mật chuỗi cung ứng phần mềm, Level 3 đảm bảo build hermetic, reproducible và verifiable).
  • Non-falsifiable provenance (dữ liệu nguồn gốc không thể giả mạo) cho container images.
  • Sử dụng các công cụ Google Cloud để đạt được điều này.

Mục tiêu là đảm bảo container images được build an toàn, có chứng minh nguồn gốc đáng tin cậy (provenance), và chỉ deploy nếu qua xác thực. Đây là yêu cầu phổ biến trong các kỳ thi chứng chỉ Google Cloud Professional Cloud Developer (cập nhật đến 2026, với SLSA Level 3 được hỗ trợ đầy đủ từ Cloud Build v2+).

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

✅ Đáp án đúng: Use Cloud Build to build container images. Configure a Binary Authorization policy on the Cloud Run job.

Lý do lựa chọn:

  • Cloud Build tự động tạo SLSA Level 3 builds và non-falsifiable provenance (dạng in-toto attestation) cho mọi container image được build, đảm bảo tính toàn vẹn và traceability từ source code đến image (hỗ trợ đầy đủ đến 2026 với Cloud Build remote execution).
  • Binary Authorization policy trên Cloud Run job sẽ xác thực (attest) provenance và signature trước khi deploy, ngăn chặn image độc hại từ supply chain attacks. Đây là cách chính thức của GCP để bảo vệ Cloud Run (kể cả Job và Service).
  • Kết hợp này đáp ứng 100% yêu cầu câu hỏi, sử dụng native GCP tools mà không cần công cụ ngoài.

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

  • ❌ [SAI] Ask developers to build container images locally and ensure strict version controls by using Container Registry.
    Giải thích sai: Build local trên máy developer không tạo SLSA Level 3 hay provenance non-falsifiable (dễ bị tamper hoặc thiếu traceability). Container Registry chỉ lưu trữ, không verify supply chain. Cách này kém bảo mật, dễ bị supply chain attack (vi phạm best practice GCP).

  • ✅ [ĐÚNG] Use Cloud Build to build container images. Configure a Binary Authorization policy on the Cloud Run job.
    Giải thích đúng: Như phần trên, Cloud Build cung cấp SLSA Level 3 + provenance chuẩn; Binary Authorization enforce policy verify trên Cloud Run, đảm bảo chỉ image "đáng tin" mới chạy. Hoàn hảo cho bảo mật Cloud Run (cập nhật 2026 hỗ trợ attest v1.0+).

  • ❌ [SAI] Use Cloud Deploy to generate authenticated and non-falsifiable build provenance for container images.
    Giải thích sai: Cloud Deploy chỉ dùng để deploy progressive rollout (không build images hay generate provenance). Nó không hỗ trợ SLSA/build, chỉ consume images từ Artifact Registry/Container Registry. Sai hoàn toàn về chức năng.

  • ❌ [SAI] Use Cloud Build to build container images. Use Cloud Scheduler to automate delivery of your applications to a series of target environments in a defined sequence.
    Giải thích sai: Cloud Build đúng cho build/provenance, nhưng Cloud Scheduler chỉ schedule job (như cron), không liên quan verify/authenticate hay Binary AuthZ. Không đảm bảo non-falsifiable controls cho Cloud Run, thiếu security layer cần thiết.

🛠️ Khuyến nghị thực hành: Implement ngay Binary Authorization với gcloud beta container binauthz policies create và trigger Cloud Build qua GitOps (Cloud Source Repositories). Test với cosign cho signature! 🚀

Câu 334
You are designing a microservices application on GKE that will expose a public API to users. Users will interact with the application by using OAuth 2.0, and illegitimate requests should receive a 403 response code. You need the API to be resilient against distributed denial of service (DDoS) attacks and critical security risks such as SQL injection (SQL) and cross-site scripting (XSS).

You want to design the application's architecture while following Google-recommended practices. What should you do?
  1. A Install Service Mesh in your GKE cluster. Configure Service Mesh user authentication to integrate the service hosted on GKE by using an OpenID Connect-compliant identity provider. Expose the application externally by using an Istio Ingress Gateway. Use VPC firewall rules to restrict Ingress traffic to the Ingress gateway.
  2. B Run an Apache HTTP server on Cloud Run to expose a service with a public IP address. Configure the Apache HTTP server as a reverse proxy to only forward valid requests to the API hosted on GKE.
  3. C Use an external Application Load Balancer with Cloud Armor. Integrate Cloud Armor with reCAPTCHA Enterprise. Configure the load balancer to forward traffic to the application hosted on GKE.
  4. D Use an external Application Load Balancer with Cloud Armor, and configure the load balancer to forward requests to Apigee to check the validity of the API requests. Configure GKE as the application's backend.
Xem giải thích

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

Câu hỏi yêu cầu thiết kế kiến trúc cho một ứng dụng microservices chạy trên GKE (Google Kubernetes Engine), expose một public API cho người dùng tương tác qua OAuth 2.0. Các yêu cầu chính bao gồm:

  • Xử lý illegitimate requests: Trả về mã lỗi 403 (Forbidden).
  • Bảo vệ chống DDoS attacks và các rủi ro bảo mật nghiêm trọng như SQL injection (SQLi) và cross-site scripting (XSS).
  • Theo Google-recommended practices (các thực hành tốt nhất của Google Cloud).

Mục tiêu là xây dựng kiến trúc resilient (bền vững), tập trung vào external traffic management, API security, và validation requests trước khi đến backend GKE. Kiến thức dựa trên phiên bản mới nhất của Google Cloud đến năm 2026, nơi Cloud Armor (nay tích hợp sâu với External ALB), Apigee (API management platform hybrid/multi-cloud), và GKE hỗ trợ Istio Service Mesh nhưng ưu tiên external load balancing cho public APIs. 📘 Tài liệu tham khảo: Google Cloud Architecture Center - Securing Microservices, Apigee Documentation, Cloud Armor Best Practices.

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

Đáp án đúng: Use an external Application Load Balancer with Cloud Armor, and configure the load balancer to forward requests to Apigee to check the validity of the API requests. Configure GKE as the application's backend.

Lý do:

  • External Application Load Balancer (ALB) + Cloud Armor cung cấp DDoS protection cấp Google (Layer 7), WAF (Web Application Firewall) chặn SQLi/XSS qua security policies và adaptive protection.
  • Apigee là API Gateway chính thức của Google, tích hợp OAuth 2.0 validation, kiểm tra API key/quotas/rate limiting, trả 403 cho invalid requests. Nó forward traffic hợp lệ đến GKE backend.
  • Đây là Google-recommended cho public APIs trên GKE: ALB → Apigee → GKE (theo blueprint microservices security). Hoàn hảo chống DDoS/SQLi/XSS và scalable đến 2026. 🛠️ Ưu điểm: Zero-trust, managed service, tích hợp reCAPTCHA nếu cần.

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

  • [SAI] Install Service Mesh in your GKE cluster. Configure Service Mesh user authentication to integrate the service hosted on GKE by using an OpenID Connect-compliant identity provider. Expose the application externally by using an Istio Ingress Gateway. Use VPC firewall rules to restrict Ingress traffic to the Ingress gateway.
    ❌ Sai vì: Service Mesh (Istio) chủ yếu cho internal service-to-service communication (mTLS, auth), không phải public exposure. Istio Ingress Gateway thiếu DDoS/WAF mạnh như Cloud Armor, chỉ auth OIDC cơ bản mà không validate OAuth đầy đủ hoặc chặn SQLi/XSS hiệu quả. VPC firewall chỉ Layer 4, không chống DDoS Layer 7. Không theo recommended practices cho public APIs (Google ưu tiên External ALB + Apigee). 📘 Nguồn: Istio on GKE Limitations.

  • [SAI] Run an Apache HTTP server on Cloud Run to expose a service with a public IP address. Configure the Apache HTTP server as a reverse proxy to only forward valid requests to the API hosted on GKE.
    ❌ Sai vì: Cloud Run không hỗ trợ public IP persistent (serverless, ephemeral), khó config Apache làm reverse proxy ổn định. Không có built-in DDoS/SQLi/XSS protection, phải tự implement (không scalable/resilient). Vi phạm nguyên tắc serverless (quản lý Apache thủ công), không handle OAuth/403 tốt, và không recommended cho public APIs trên GKE. 🛠️ Vấn đề: Tăng complexity, chi phí cao, không theo best practices.

  • [SAI] Use an external Application Load Balancer with Cloud Armor. Integrate Cloud Armor with reCAPTCHA Enterprise. Configure the load balancer to forward traffic to the application hosted on GKE.
    ❌ Sai vì: External ALB + Cloud Armor tốt cho DDoS/WAF (SQLi/XSS), reCAPTCHA chống bot, nhưng thiếu API validation (OAuth, request validity). Không có mechanism trả 403 cho illegitimate API calls hoặc quota management. Forward trực tiếp đến GKE bỏ qua API gateway, không resilient đầy đủ cho microservices public. Apigee cần thiết để check validity. 📘 Nguồn: Cloud Armor vs Apigee.

  • [ĐÚNG] Use an external Application Load Balancer with Cloud Armor, and configure the load balancer to forward requests to Apigee to check the validity of the API requests. Configure GKE as the application's backend.
    ✅ Đúng vì: Kết hợp hoàn hảo ALB + Cloud Armor (DDoS/WAF chống SQLi/XSS) → Apigee (OAuth validation, 403 cho invalid, API policies) → GKE backend. Đầy đủ resilience, security, theo Google Cloud Well-Architected Framework (Reliability & Security pillars). Scalable, managed đến 2026. 🛠️ Lợi ích: End-to-end protection, analytics từ Apigee. 📘 Nguồn: Apigee + GKE Integration, Secure API Architecture.

Câu 335
You are compiling a compliance report on vulnerability metadata for a specific set of images identified by Artifact Analysis. Metadata from images scanned more than 30 days ago are missing from the compliance report. You need to access the vulnerability metadata for these older images. What should you do?
  1. A Create a Pub/Sub subscription to pull from Artifact Analysis topics.
  2. B Check Artifact Analysis storage buckets in Cloud Storage.
  3. C Push or pull the images from Artifact Registry.
  4. D Check Cloud Trace logs for Artifact Analysis findings.
Xem giải thích

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

Câu hỏi này thuộc lĩnh vực Google Cloud Platform (GCP), cụ thể là dịch vụ Artifact Analysis (tích hợp với Artifact Registry để quét lỗ hổng bảo mật cho container images). Tình huống: Bạn đang biên soạn báo cáo tuân thủ (compliance report) về metadata lỗ hổng (vulnerability metadata) cho một bộ images cụ thể đã được Artifact Analysis quét. Tuy nhiên, metadata của các images quét hơn 30 ngày trước bị thiếu trong báo cáo. Nhiệm vụ: Truy cập metadata lỗ hổng cho những images cũ này.

Lý do vấn đề xảy ra (dựa trên tài liệu GCP cập nhật đến 2026): Artifact Analysis lưu trữ metadata tạm thời trong khoảng 30 ngày cho báo cáo compliance. Sau thời gian này, metadata cũ không còn khả dụng trực tiếp qua API báo cáo. Để lấy lại, cần kích hoạt quét lại (rescan) bằng cách push hoặc pull image từ Artifact Registry, giúp metadata được cập nhật và truy xuất trở lại. Đây là cơ chế retention policy mới nhất của GCP (Artifact Registry v2.x).

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

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

Đáp án đúng: Push or pull the images from Artifact Registry.

Lý do 🛠️:

  • Khi push (đẩy) hoặc pull (kéo) image từ Artifact Registry, Artifact Analysis sẽ tự động kích hoạt quét lại (rescan), tạo metadata mới dựa trên dữ liệu lịch sử và làm cho metadata cũ khả dụng trong báo cáo compliance.
  • Đây là phương pháp chính thức được GCP khuyến nghị cho trường hợp metadata >30 ngày, tránh mất dữ liệu và đảm bảo tuân thủ. Không cần công cụ bên ngoài, chỉ thao tác trực tiếp trên registry.

❌ 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 một cách chi tiết:

  • [SAI] Create a Pub/Sub subscription to pull from Artifact Analysis topics.
    ❌ Sai vì: Pub/Sub chỉ dùng để publish thông báo thời gian thực về kết quả quét mới (new findings), không lưu trữ hoặc cung cấp metadata cũ >30 ngày. Subscription chỉ pull events mới, không truy xuất lịch sử. (Không giải quyết vấn đề metadata thiếu trong báo cáo).

  • [SAI] Check Artifact Analysis storage buckets in Cloud Storage.
    ❌ Sai vì: Artifact Analysis không lưu metadata vào Cloud Storage buckets. Dữ liệu được quản lý nội bộ trong Artifact Registry metadata store, không export tự động ra buckets. Kiểm tra buckets chỉ lãng phí thời gian và không có dữ liệu liên quan.

  • [ĐÚNG] Push or pull the images from Artifact Registry.
    ✅ Đúng vì: Như giải thích ở trên, hành động này trigger rescan, khôi phục metadata cũ vào báo cáo. Hiệu quả, đơn giản và tuân thủ best practices GCP (không ảnh hưởng chi phí lớn trừ khi image lớn).

  • [SAI] Check Cloud Trace logs for Artifact Analysis findings.
    ❌ Sai vì: Cloud Trace dành cho tracing hiệu suất ứng dụng (latency, spans), không lưu vulnerability findings từ Artifact Analysis. Logs findings nằm ở Cloud Logging hoặc trực tiếp Artifact Registry API, không phải Trace.

Tóm tắt khuyến nghị 🚀: Luôn kiểm tra Artifact Registry dashboard sau push/pull để xác nhận metadata cập nhật. Nếu quy mô lớn, dùng gcloud CLI: gcloud artifacts images scan <IMAGE_URL>.

Câu 336
Your team runs a Python job that reads millions of customer record files stored in a Cloud Storage bucket. To comply with regulatory requirements, you need to ensure that customer data is immediately deleted once the job is completed. You want to minimize the time required to complete this task. What should you do?
  1. A Add a final step in the job that deletes all the objects in the bucket in bulk by using batch requests to the Cloud Storage API.
  2. B Configure Object Lifecycle Management on the Cloud Storage bucket that deletes all the objects in the bucket at the end of the job execution.
  3. C Remove the bucket from the Google Cloud console when the job is completed
  4. D Use the gcloud CLI to execute the gcloud storage rm --recursive gs://BUCKET_NAME/ command.
Xem giải thích

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

Câu hỏi mô tả một tình huống thực tế trong Google Cloud Platform (GCP): Nhóm phát triển chạy một công việc Python (job) đọc hàng triệu file dữ liệu khách hàng lưu trữ trong một Cloud Storage bucket. Để tuân thủ yêu cầu quy định pháp lý (regulatory requirements), dữ liệu khách hàng phải được xóa ngay lập tức sau khi job hoàn thành. Mục tiêu là giảm thiểu thời gian thực hiện nhiệm vụ xóa này.

🔑 Yêu cầu chính:

  • Xóa dữ liệu ngay lập tức (immediately) sau job.
  • Xử lý hàng triệu objects (millions of customer record files) một cách hiệu quả.
  • Tối ưu thời gian hoàn thành (minimize the time).

Câu hỏi tập trung vào cách tích hợp xóa dữ liệu vào quy trình job Python, sử dụng các tính năng của Google Cloud Storage (phiên bản cập nhật đến 2026, hỗ trợ batch delete qua XML API hoặc JSON API với giới hạn lên đến 1000 objects/batch, và cải tiến performance cho large-scale deletion).

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

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

Đáp án đúng: Add a final step in the job that deletes all the objects in the bucket in bulk by using batch requests to the Cloud Storage API.

Lý do 🛠️:

  • Phương án này tích hợp trực tiếp vào job Python như một bước cuối (final step), đảm bảo xóa ngay lập tức sau khi đọc dữ liệu.
  • Sử dụng batch requests qua Cloud Storage API (XML/JSON API) cho phép xóa bulk (hàng loạt) lên đến 1000 objects mỗi request, tối ưu cho millions of objects bằng cách lặp batch song song.
  • Giảm thiểu thời gian: Batch delete nhanh hơn delete từng object (parallel processing), phù hợp quy mô lớn, và không phụ thuộc bên ngoài (như CLI hoặc console).
  • Hoàn toàn tự động hóa trong code Python (sử dụng thư viện google-cloud-storage), đảm bảo tuân thủ quy định mà không cần can thiệp thủ công.

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

Dưới đây là phân tích chi tiết từng lựa chọn, giữ nguyên văn bản gốc bằng tiếng Anh. Tôi đánh dấu ✅ đúng hoặc ❌ sai, kèm lý do bằng tiếng Việt:

  • ✅ Add a final step in the job that deletes all the objects in the bucket in bulk by using batch requests to the Cloud Storage API.
    🛠️ Đúng vì: Như đã giải thích ở trên, đây là cách tối ưu nhất cho immediate bulk delete trong job, hỗ trợ scale lớn với performance cao (theo docs GCP 2026, batch size 1000+ với retry logic).

  • ❌ Configure Object Lifecycle Management on the Cloud Storage bucket that deletes all the objects in the bucket at the end of the job execution.
    🚫 Sai vì: Lifecycle Management chỉ hỗ trợ xóa dựa trên điều kiện thời gian (age, date) hoặc số phiên bản, không thể trigger "ngay lập tức" theo job execution. Việc config lifecycle mất thời gian setup và không immediate (có độ trễ polling ~1 ngày), không phù hợp minimize time cho millions objects.

  • ❌ Remove the bucket from the Google Cloud console when the job is completed
    🚫 Sai vì: Xóa bucket qua Console là thủ công, không tự động, và không an toàn (xóa bucket vĩnh viễn, nhưng job có thể cần bucket cho lần chạy sau). Với millions objects, xóa bucket mất thời gian dài (GCP charge cho delete operations), không integrate vào job và không minimize time.

  • ❌ Use the gcloud CLI to execute the gcloud storage rm --recursive gs://BUCKET_NAME/ command.
    🚫 Sai vì: gcloud storage rm --recursive là lệnh CLI bên ngoài job, phải chạy thủ công hoặc script riêng sau job, không immediate. Với millions objects, lệnh này chậm (sequential delete mặc định, dù có parallel flag nhưng giới hạn), dễ timeout và không tích hợp trực tiếp vào Python job.

Kết luận 🎯: Phương án đúng tận dụng API native để tự động, nhanh chóng và scalable, phù hợp best practice GCP cho data compliance! Nếu cần code sample Python batch delete, hãy hỏi thêm nhé. 🚀

Câu 337
You have a Cloud Run service that needs to connect to a Cloud SQL instance in a different project. You provisioned the Cloud Run service account with the Cloud SQL Client IAM role on the project that is hosting Cloud SQL. However, when you test the connection, the connection fails. You want to fix the connection failure while following Google-recommended practices. What should you do?
  1. A Add the cloudsql.instances.connect IAM permission to the Cloud Run service account.
  2. B Request additional API quota for Cloud SQL Auth Proxy,
  3. C Enable the Cloud SQL Admin API in both projects.
  4. D Migrate the Cloud SQL instance into the same project as the Cloud Run service.
Xem giải thích

🧩 Phân tích nội dung câu hỏi
Câu hỏi mô tả tình huống thực tế trong Google Cloud Platform (GCP): Bạn có một dịch vụ Cloud Run (chạy serverless) cần kết nối đến một instance Cloud SQL (cơ sở dữ liệu quan hệ được quản lý) nằm ở project khác. Bạn đã cấp quyền IAM role Cloud SQL Client (roles/cloudsql.client) cho service account của Cloud Run trên project chứa Cloud SQL. Tuy nhiên, khi kiểm tra kết nối, nó thất bại. Nhiệm vụ là sửa lỗi này theo best practices được Google khuyến nghị, nghĩa là ưu tiên giải pháp an toàn, không di chuyển tài nguyên, và tuân thủ mô hình cross-project mà GCP hỗ trợ tốt (không bắt buộc cùng project).

Vấn đề cốt lõi: Kết nối Cloud Run đến Cloud SQL cross-project thường sử dụng Cloud SQL connector (kết nối qua Unix socket, an toàn và serverless), nhưng cần các điều kiện API và quyền IAM đầy đủ. Việc chỉ cấp role Client chưa đủ nếu API liên quan chưa kích hoạt đúng cách. (Kiến thức cập nhật đến 2026: GCP vẫn khuyến nghị cách này, không thay đổi lớn từ 2023-2026 theo docs chính thức).

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

✅ Đáp án đúng: Enable the Cloud SQL Admin API in both projects.
Lý do chi tiết: Theo best practices GCP, để Cloud Run (consumer project) kết nối Cloud SQL (host project) qua Cloud SQL connector cross-project, Cloud SQL Admin API (sqladmin.googleapis.com) phải được kích hoạt trên cả hai project.

  • Trên host project (Cloud SQL): API cần thiết để phục vụ metadata instance và cho phép truy cập từ xa. Nếu chưa enable, instance có thể tồn tại nhưng kết nối proxy/connector fail.
  • Trên consumer project (Cloud Run): API cần để service account gọi Admin API, lấy thông tin instance (như IP private, certs) và thiết lập kết nối an toàn. Chỉ cấp role Client chưa đủ nếu API chưa enable ở consumer project – đây là nguyên nhân phổ biến gây fail sau khi grant role.
    Cách fix: Vào Console > APIs & Services > Library, search "Cloud SQL Admin API" và enable ở cả hai project. Không ảnh hưởng quota, an toàn, và tuân thủ zero-trust model. (Xác nhận từ docs 2024-2026, không thay đổi).

🛠️ Giải thích tất cả các phương án (Giữ nguyên text gốc, phân tích bằng tiếng Việt):

  • Add the cloudsql.instances.connect IAM permission to the Cloud Run service account.
    ❌ Sai: Role Cloud SQL Client (đã cấp) đã bao gồm permission cloudsql.instances.connect và các quyền cần thiết khác (như cloudsql.instances.get, cloudsql.users.create). Thêm permission riêng lẻ không cần thiết, vi phạm nguyên tắc least privilege (chỉ dùng role chuẩn). Không fix được nếu API chưa enable.

  • Request additional API quota for Cloud SQL Auth Proxy.
    ❌ Sai: Cloud Run sử dụng Cloud SQL connector (tích hợp sẵn, không phải Auth Proxy riêng). Auth Proxy dùng cho VM/ on-prem, quota mặc định đủ cho hầu hết cases (không liên quan fail cross-project). Request quota thừa, không theo best practice.

  • Enable the Cloud SQL Admin API in both projects.
    ✅ Đúng: Như giải thích trên, đây là bước bắt buộc theo docs GCP cho kết nối cross-project an toàn. Fix trực tiếp lỗi mà không di chuyển tài nguyên hay cấp quyền thừa.

  • Migrate the Cloud SQL instance into the same project as the Cloud Run service.
    ❌ Sai: Không cần thiết và không phải best practice! GCP hỗ trợ cross-project tốt (VPC peering/Private Service Connect), migrate tốn kém (downtime, chi phí export/import data), phức tạp billing/quota. Khuyến nghị giữ nguyên và fix bằng IAM/API.

🧩 Tóm tắt khuyến nghị: Luôn kiểm tra APIs enabled trước IAM khi troubleshoot kết nối Cloud SQL cross-project. Test bằng gcloud sql connect hoặc deploy Cloud Run revision mới sau fix! 🚀

Câu 338
You developed a Python script that retrieves information from files that are uploaded to Cloud Storage and writes the information to Bigtable. You have completed testing on your local environment and created the python-script service account with the Bigtable User IAM role. You want to deploy the code with the appropriate authentication while following Google-recommended practices. What should you do?
  1. A 1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.
    2. Configure IAM binding for authentication.
  2. B 1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.
    2. Create a service account key for authentication
  3. C 1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.
    2. Configure IAM binding for authentication.
  4. D 1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.
    2. Create a service account key for authentication.
Xem giải thích

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

Câu hỏi này thuộc chủ đề Google Cloud Platform (GCP), tập trung vào việc triển khai một script Python theo cách event-driven (kích hoạt sự kiện) và tuân thủ best practices về xác thực (authentication) của Google.

  • Tình huống: Bạn đã phát triển script Python để đọc thông tin từ các file được upload lên Cloud Storage và ghi dữ liệu vào Bigtable. Script đã test thành công trên môi trường local. Bạn đã tạo service account (SA) tên "python-script" với quyền Bigtable User IAM role (cho phép ghi dữ liệu vào Bigtable).
  • Yêu cầu chính: Triển khai (deploy) code lên production với xác thực phù hợp, ưu tiên Google-recommended practices:
    • Event-driven: Tự động kích hoạt khi file upload vào Storage (không polling thủ công).
    • Authentication an toàn: Sử dụng IAM bindings (workload identity federation hoặc attach SA trực tiếp) thay vì service account key (vì key dễ bị lộ, không an toàn theo best practices GCP).
  • Mục tiêu: Đảm bảo script chạy serverless, scalable, bảo mật cao, không cần quản lý key thủ công.

Lưu ý kiến thức cập nhật (2026): Theo GCP docs mới nhất (Cloud Functions Gen 2, Cloud Run fully managed), ưu tiên Cloud Functions cho event triggers từ Storage. Không dùng SA key từ 2022 trở đi (deprecated cho production). Tham khảo: Cloud Functions triggers & IAM best practices.

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

Đáp án đúng:
1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.
2. Configure IAM binding for authentication.

Lý do chi tiết 🛠️:

  • Bước 1: Cloud Functions lý tưởng cho script Python serverless, hỗ trợ Cloud Storage trigger (eventarc hoặc legacy) tự động chạy khi file upload (finalize event). Điều này event-driven, tiết kiệm chi phí (chỉ chạy khi cần), phù hợp best practices GCP.
  • Bước 2: IAM binding attach SA "python-script" vào Cloud Functions runtime service account (mặc định hoặc custom). Không cần key – dùng Workload Identity hoặc direct binding, an toàn 100% (không lưu key file). SA đã có Bigtable User role → script truy cập Bigtable seamless.
  • Ưu điểm: Scalable, zero cold-start dài hạn (Gen 2), tuân thủ "principle of least privilege".

📋 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 cách chi tiết, giữ nguyên text gốc tiếng Anh. Mỗi phương án được đánh giá ✅ (đúng hoàn toàn) hoặc ❌ (sai), kèm lý do cụ thể bằng tiếng Việt.

  • Phương án ĐÚNG ✅:
    1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.
    2. Configure IAM binding for authentication.
    Giải thích: Hoàn hảo theo best practices GCP! 🏆 Cloud Functions + Storage trigger = event-driven chính xác (file upload → trigger ngay lập tức). IAM binding an toàn, không key, SA "python-script" được bind trực tiếp → script đọc Storage (public/default perms) và ghi Bigtable mượt mà. Nguồn: GCP Eventarc for Storage.

  • Phương án SAI ❌:
    1. Deploy your code to Cloud Functions. Create a Cloud Storage trigger.
    2. Create a service account key for authentication.
    Giải thích: Bước 1 đúng (Cloud Functions + trigger tốt), nhưng bước 2 SAI nặng! 🚫 Tạo SA key (.json) vi phạm best practices GCP (dễ leak, phải rotate thường xuyên, deprecated cho serverless từ 2022). Thay vào đó dùng IAM binding. Không recommend cho production.

  • Phương án SAI ❌:
    1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.
    2. Configure IAM binding for authentication.
    Giải thích: Toàn bộ SAI! 🕒 Cloud Run cần container image (không phải script Python thuần), phải dockerize → phức tạp thừa. Cloud Scheduler trigger mỗi phút = polling (không event-driven, tốn chi phí idle, miss real-time). IAM binding đúng nhưng không cứu vãn được thiết kế kém. Không phù hợp use case upload file.

  • Phương án SAI ❌:
    1. Deploy your image to Cloud Run. Create a trigger in Cloud Scheduler that triggers the service every minute.
    2. Create a service account key for authentication.
    Giải thích: Sai kép tệ nhất! 😱 Cùng vấn đề Cloud Run + polling (không event-driven, tốn kém). Thêm SA key → double insecure (phải mount key vào container, rủi ro cao). Vi phạm mọi best practices GCP về serverless và auth.

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

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

Câu 339
You are a developer at a large organization. Your team uses Git for source code management (SCM). You want to ensure that your team follows Google-recommended best practices to manage code to drive higher rates of software delivery. Which SCM process should your team use?
  1. A Each developer commits their code to the main branch before each product release, conducts testing, and rolls back if integration issues are detected.
  2. B Each group of developers copies the repository, commits their changes to their repository, and merges their code into the main repository before each product release.
  3. C Each developer creates a branch for their own work, commits their changes to their branch, and merges their code into the main branch daily.
  4. D Each group of developers creates a feature branch from the main branch for their work, commits their changes to their branch, and merges their code into the main branch before each major release.
Xem giải thích

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

Câu hỏi này tập trung vào quy trình quản lý mã nguồn (SCM - Source Code Management) sử dụng Git, nhằm đảm bảo đội ngũ phát triển tuân thủ các thực hành tốt nhất được Google khuyến nghị để tăng tốc độ giao hàng phần mềm (software delivery). Cụ thể, bạn là lập trình viên tại một tổ chức lớn, sử dụng Git làm công cụ SCM, và cần chọn quy trình giúp tối ưu hóa tích hợp liên tục (CI), giảm rủi ro, và thúc đẩy phát triển nhanh chóng.

🛠️ Bối cảnh chính: Google khuyến nghị mô hình Trunk-Based Development (TBD) – phát triển dựa trên trunk (nhánh chính), nơi các thay đổi nhỏ được commit thường xuyên (hàng ngày hoặc nhiều lần/ngày) vào nhánh chính để tránh tích tụ code cũ, giảm merge conflict, và hỗ trợ CI/CD hiệu quả. Điều này được nhấn mạnh trong các tài liệu của Google về SRE (Site Reliability Engineering) và best practices cho developer productivity, giúp đạt higher rates of software delivery như DORA metrics (Deployment Frequency cao).

📘 Nguồn tham khảo:

  • Trunk-Based Development (được Google và các công ty lớn áp dụng, cập nhật liên tục đến 2026).
  • Google Cloud Skills Boost: "Google Cloud Professional Cloud Developer" course (module về CI/CD và SCM best practices).
  • Google's SRE Book (Chapter 6: Implementing CI/CD, khuyến nghị merge daily).

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

Đáp án đúng: Each developer creates a branch for their own work, commits their changes to their branch, and merges their code into the main branch daily.

Lý do:

  • 🟢 Đây chính là Trunk-Based Development (TBD) – mô hình cốt lõi của Google. Mỗi developer tạo branch ngắn hạn (short-lived, thường 1-2 ngày), commit thay đổi vào branch cá nhân, rồi merge hàng ngày vào main branch (trunk).
  • 🛠️ Lợi ích: Giảm tích tụ code, phát hiện lỗi sớm qua CI, hỗ trợ automated testing, và tăng Deployment Frequency (một trong Elite Performer metrics của DORA report 2023-2026). Google chứng minh TBD giúp tổ chức lớn scale development hiệu quả, tránh "integration hell".

❌ 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 một cách chi tiết. Tôi giữ nguyên nội dung văn bản gốc bằng tiếng Anh, chỉ giải thích hoàn toàn bằng tiếng Việt với lý do đúng/sai dựa trên best practices Google mới nhất (2026).

  • Each developer commits their code to the main branch before each product release, conducts testing, and rolls back if integration issues are detected.
    ❌ Sai: Quy trình này là direct commit to main chỉ trước release, dẫn đến tích tụ thay đổi lớn (big bang integration). Google không khuyến nghị vì gây merge conflict lớn, testing muộn, và rollback khó khăn. Thay vào đó, TBD yêu cầu merge thường xuyên, không chờ release.

  • Each group of developers copies the repository, commits their changes to their repository, and merges their code into the main repository before each product release.
    ❌ Sai: Đây là forking model (như GitHub fork), phù hợp cho open-source lớn nhưng không lý tưởng cho team nội bộ. Nhóm dev copy repo riêng gây duplicate effort, merge lớn trước release dẫn đến conflict cao. Google ưu tiên single repo với branches nhỏ, tránh fork để giữ traceability và CI nhanh.

  • Each developer creates a branch for their own work, commits their changes to their branch, and merges their code into the main branch daily.
    ✅ Đúng: Như đã giải thích ở trên, đây là trunk-based development chuẩn Google. Branch cá nhân ngắn hạn + merge daily đảm bảo code luôn fresh, hỗ trợ CI/CD pipeline (như Cloud Build hoặc Jenkins), và phù hợp với Google Cloud best practices cho high-velocity development.

  • Each group of developers creates a feature branch from the main branch for their work, commits their changes to their branch, and merges their code into the main branch before each major release.
    ❌ Sai: Đây là GitFlow/feature branch model, với branch dài hạn cho nhóm và merge chỉ trước major release. Google cảnh báo chống lại vì branch dài (>1-2 ngày) gây divergence, testing khó, và chậm delivery. TBD yêu cầu merge nhanh (daily), không chờ major release.

🧠 Kết luận: Chọn TBD để đạt Google-recommended practices, giúp team của bạn trở thành "Elite Performer" theo DORA (Deployment Frequency > daily, Lead Time <1 ngày). Áp dụng ngay với tools như Google Cloud Source Repositories hoặc GitHub Enterprise! 🚀

Câu 340
You work for an ecommerce company. You are developing a new application with the following requirements:
• The application must have access to the most up-to-date data at all times.
• Due to company policy, data older than 30 days must be automatically deleted.

You need to determine which service should host the database, and how to configure the data deletion. You want to use the most efficient solution. What should you do?
  1. A Configure Spanner to host the database. Use Data Catalog to delete data older than 30 days.
  2. B Configure Spanner to host the database. Create a time-to-live policy that deletes data older than 30 days.
  3. C Configure Bigtable to host the database. Create a time-to-live policy that deletes data older than 30 days.
  4. D Configure Bigtable to host the database. Create a garbage collection policy in Bigtable that deletes data older than 30 days.
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 mô tả một công ty thương mại điện tử (ecommerce) đang phát triển ứng dụng mới với hai yêu cầu chính:

  • Ứng dụng phải truy cập dữ liệu mới nhất (most up-to-date data) mọi lúc → Nghĩa là cần cơ sở dữ liệu hỗ trợ tính nhất quán cao (strong consistency), độ trễ thấp, phù hợp cho workload real-time như theo dõi đơn hàng, phiên người dùng.
  • Dữ liệu cũ hơn 30 ngày phải tự động bị xóa theo chính sách công ty → Cần cơ chế xóa dữ liệu tự động dựa trên thời gian (time-based deletion), hiệu quả và không cần can thiệp thủ công.
    Bạn cần chọn dịch vụ database của Google Cloud để host và cấu hình xóa dữ liệu, ưu tiên giải pháp hiệu quả nhất (most efficient) về chi phí, hiệu suất cho scale lớn (ecommerce thường có dữ liệu volume cao, append-only như logs, metrics).
    ✅ Yêu cầu cốt lõi: Database phải scalable, real-time, hỗ trợ auto-deletion policy native (không dùng script cron job), và Bigtable là lựa chọn tối ưu cho non-relational, high-throughput workloads như thế này (dữ liệu thời gian thực với TTL tự nhiên).

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

Đáp án đúng: Configure Bigtable to host the database. Create a garbage collection policy in Bigtable that deletes data older than 30 days.

🛠️ Lý do chi tiết:

  • Bigtable là NoSQL wide-column store lý tưởng cho ecommerce: Hỗ trợ strong consistency cho single-row operations (đảm bảo up-to-date data), throughput cực cao (hàng triệu ops/sec), chi phí thấp cho dữ liệu lớn, time-series (như user sessions, inventory changes).
  • Garbage Collection (GC) policy là tính năng native của Bigtable, cho phép xóa tự động cells/versions cũ hơn 30 ngày (dựa trên age), rất hiệu quả vì chạy background, không ảnh hưởng performance, tiết kiệm storage tự động.
  • Đây là most efficient vì Bigtable rẻ hơn Spanner cho workloads non-relational, scale ngang vô hạn, phù hợp yêu cầu "up-to-date at all times" mà không cần relational schema phức tạp.
    (Cập nhật 2026: Bigtable GC vẫn là standard, hỗ trợ maxAge policy chính xác cho deletion sau 30 days - docs mới nhất xác nhận không thay đổi cơ bản).

📘 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, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh dấu ✅ (đúng) hoặc ❌ (sai), kèm giải thích bằng tiếng Việt:

  • ❌ Configure Spanner to host the database. Use Data Catalog to delete data older than 30 days.
    Sai vì Data Catalog chỉ là dịch vụ metadata/search (quản lý catalog dữ liệu), không hỗ trợ xóa dữ liệu tự động trong database. Spanner (relational DB globally consistent) phù hợp up-to-date data nhưng kết hợp sai công cụ, không efficient (phải viết script riêng, vi phạm "automatic").

  • ❌ Configure Spanner to host the database. Create a time-to-live policy that deletes data older than 30 days.
    Sai dù Spanner có TTL policy (từ 2023, xóa rows tự động dựa trên timestamp column). Tuy nhiên, không phải most efficient cho ecommerce non-relational/high-volume: Spanner đắt hơn (billing theo nodes), phức tạp schema, kém scale cho append-only data so với Bigtable. TTL chỉ áp dụng cho base/interleaved tables, không tối ưu chi phí/performance.

  • ❌ Configure Bigtable to host the database. Create a time-to-live policy that deletes data older than 30 days.
    Sai vì Bigtable không dùng "time-to-live (TTL) policy" – thuật ngữ này dành cho Spanner/Firestore. Bigtable dùng Garbage Collection (GC) thay thế. Gọi sai policy → không implement được, dù Bigtable đúng database.

  • ✅ Configure Bigtable to host the database. Create a garbage collection policy in Bigtable that deletes data older than 30 days.
    Đúng hoàn toàn như giải thích ở phần đáp án. Native, efficient, khớp mọi yêu cầu.

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