Ngân hàng đề — AWS Certified Data Engineer Associate
Tìm thấy 867 câu.
An extract, transform, and load (ETL) job runs every morning to update the Redshift cluster with new data from the PostgreSQL database. The company has grown rapidly and needs to cost optimize the Redshift cluster.
A data engineer needs to create a solution to archive historical data. The data engineer must be able to run analytics queries that effectively combine data from live transactional data in PostgreSQL, current data in Redshift, and archived historical data. The solution must keep only the most recent 15 months of data in Amazon Redshift to reduce costs.
Which combination of steps will meet these requirements? (Choose two.)
- A Configure the Amazon Redshift Federated Query feature to query live transactional data that is in the PostgreSQL database.
- B Configure Amazon Redshift Spectrum to query live transactional data that is in the PostgreSQL database.
- C Schedule a monthly job to copy data that is older than 15 months to Amazon S3 by using the UNLOAD command. Delete the old data from the Redshift cluster. Configure Amazon Redshift Spectrum to access historical data in Amazon S3.
- D Schedule a monthly job to copy data that is older than 15 months to Amazon S3 Glacier Flexible Retrieval by using the UNLOAD command. Delete the old data from the Redshift cluster. Configure Redshift Spectrum to access historical data from S3 Glacier Flexible Retrieval.
- E Create a materialized view in Amazon Redshift that combines live, current, and historical data from different sources.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi mô tả một công ty bán lẻ sử dụng Amazon Aurora PostgreSQL để xử lý và lưu trữ dữ liệu giao dịch thời gian thực (live transactional data), đồng thời dùng Amazon Redshift cluster làm data warehouse. Một job ETL (Extract, Transform, Load) chạy hàng sáng để cập nhật dữ liệu mới từ PostgreSQL vào Redshift. Do công ty phát triển nhanh chóng, họ cần tối ưu chi phí cho Redshift bằng cách chỉ giữ 15 tháng dữ liệu gần nhất trong Redshift. Đồng thời, cần giải pháp lưu trữ dữ liệu lịch sử (historical data) và hỗ trợ chạy analytics queries kết hợp hiệu quả từ ba nguồn:
- Dữ liệu live từ PostgreSQL.
- Dữ liệu hiện tại (current) trong Redshift.
- Dữ liệu lịch sử đã lưu trữ.
Yêu cầu chọn TWO steps (hai bước) để đáp ứng: lưu trữ lịch sử, xóa dữ liệu cũ khỏi Redshift, và query cross-source mà không làm tăng chi phí đáng kể. Đây là chủ đề về Redshift optimization, Federated Query, Spectrum, và data lifecycle management (cập nhật theo AWS 2024-2026, với Redshift hỗ trợ federated queries mở rộng và Spectrum layer cho S3).
✅ Đáp án đúng (Chọn TWO)
Hai phương án đúng là sự kết hợp hoàn hảo để:
- Query live data từ PostgreSQL mà không cần di chuyển dữ liệu (sử dụng Redshift Federated Query).
- Lưu trữ historical data >15 tháng vào S3 (rẻ hơn Redshift), xóa khỏi Redshift, và query qua Redshift Spectrum (zero-ETL cho analytics).
-
Configure the Amazon Redshift Federated Query feature to query live transactional data that is in the PostgreSQL database.
✅ Lý do đúng: Redshift Federated Query (ra mắt 2021, cập nhật 2025 với pushdown predicates tốt hơn) cho phép Redshift query trực tiếp dữ liệu live từ Aurora PostgreSQL qua SQL tiêu chuẩn, mà không cần ETL hay copy data. Điều này hỗ trợ kết hợp query seamless giữa live PostgreSQL + current Redshift + historical, giảm latency và chi phí lưu trữ. -
Schedule a monthly job to copy data that is older than 15 months to Amazon S3 by using the UNLOAD command. Delete the old data from the Redshift cluster. Configure Amazon Redshift Spectrum to access historical data in Amazon S3.
✅ Lý do đúng: Sử dụng UNLOAD command để export dữ liệu cũ (>15 tháng) ra S3 (rẻ ~90% so với Redshift), xóa khỏi cluster để tiết kiệm chi phí compute/storage. Redshift Spectrum (serverless query engine) cho phép query Parquet/CSV/ORC trên S3 trực tiếp từ Redshift SQL, hỗ trợ federated joins với dữ liệu live/current. Job monthly phù hợp lifecycle management.
📋 Phân tích chi tiết từng phương án
Dưới đây là phân tích tất cả 5 phương án, giữ nguyên văn bản gốc tiếng Anh. Mỗi phương án được đánh giá đúng/sai dựa trên tính khả thi, chi phí, và khả năng query kết hợp (theo tài liệu AWS mới nhất 2026).
-
Configure the Amazon Redshift Federated Query feature to query live transactional data that is in the PostgreSQL database.
✅ Đúng: Như giải thích trên, Federated Query hỗ trợ PostgreSQL/Aurora trực tiếp với predicate pushdown, caching, và security IAM/VPC. Không cần ETL cho live data, lý tưởng cho analytics real-time kết hợp. -
Configure Amazon Redshift Spectrum to query live transactional data that is in the PostgreSQL database.
❌ Sai: Redshift Spectrum chỉ query dữ liệu trên S3 (Parquet/JSON/etc.), không hỗ trợ trực tiếp PostgreSQL. Không thể dùng Spectrum cho live relational DB như Aurora; phải dùng Federated Query thay thế. -
Schedule a monthly job to copy data that is older than 15 months to Amazon S3 by using the UNLOAD command. Delete the old data from the Redshift cluster. Configure Amazon Redshift Spectrum to access historical data in Amazon S3.
✅ Đúng: Như giải thích trên. UNLOAD là native command hiệu quả (parallel export), S3 Standard/IA rẻ cho historical, Spectrum query on-demand mà không load data vào Redshift (tiết kiệm ~80% chi phí). -
Schedule a monthly job to copy data that is older than 15 months to Amazon S3 Glacier Flexible Retrieval by using the UNLOAD command. Delete the old data from the Redshift cluster. Configure Redshift Spectrum to access historical data from S3 Glacier Flexible Retrieval.
❌ Sai: Mặc dù UNLOAD ra S3 Glacier được, nhưng Redshift Spectrum không hỗ trợ query trực tiếp Glacier storage classes (Flexible/Deep Archive). Spectrum yêu cầu S3 Standard/IA/Intelligent-Tiering; query Glacier cần restore (latency 1-12h, chi phí cao), không phù hợp analytics nhanh. -
Create a materialized view in Amazon Redshift that combines live, current, and historical data from different sources.
❌ Sai: Materialized view trong Redshift chỉ refresh từ bảng nội bộ Redshift hoặc Spectrum (incremental/auto-refresh), không hỗ trợ trực tiếp live data từ PostgreSQL mà không ETL liên tục. Sẽ tăng chi phí compute refresh và không scale cho live data động.
🛠️ Khuyến nghị triển khai & Tài liệu tham khảo 📘
- Triển khai: Sử dụng AWS Glue/Step Functions cho monthly UNLOAD job (Lambda trigger). Kích hoạt Spectrum external tables với
CREATE EXTERNAL SCHEMA. Test query:SELECT * FROM federated_pg.live_table JOIN redshift.current_table JOIN spectrum.historical_table. - Lợi ích chi phí: Giảm Redshift storage ~70-90%, query on-demand qua Spectrum/Federated chỉ tính theo scan data.
- Tài liệu AWS (cập nhật 2026):
- Redshift Federated Query ✅ Hỗ trợ PostgreSQL.
- Redshift Spectrum ✅ Chỉ S3 non-Glacier.
- UNLOAD Command.
- Redshift Best Practices.
Giải pháp này zero-ETL hybrid lakehouse, phù hợp DevOps Engineer Professional! 🚀
The company's operations team recently observed many WriteThroughputExceeded exceptions. The operations team found that some shards were heavily used but other shards were generally idle.
How should the company resolve the issues that the operations team observed?
- A Change the partition key from facility ID to a randomly generated key.
- B Increase the number of shards.
- C Archive the data on the producer's side.
- D Change the partition key from facility ID to capture date.
Xem giải thích
🧩 Phân tích nội dung câu hỏi
Câu hỏi xoay quanh một công ty sản xuất sử dụng Amazon Kinesis Data Streams để thu thập dữ liệu từ các thiết bị IoT trên toàn cầu. Dữ liệu bao gồm: device ID, capture date (ngày thu thập), measurement type (loại đo lường), measurement value (giá trị đo), và facility ID (ID cơ sở). Họ đang dùng facility ID làm partition key để phân vùng dữ liệu.
🔥 Vấn đề chính: Nhóm vận hành phát hiện nhiều ngoại lệ WriteThroughputExceeded (vượt quá thông lượng ghi). Nguyên nhân: Một số shards bị sử dụng nặng (hot shards - quá tải), trong khi các shards khác nhàn rỗi (idle shards). Điều này xảy ra do skewed partition key (phân bố không đều): Các facility lớn gửi dữ liệu nhiều hơn, dẫn đến overload một vài shards, trong khi shards khác trống.
🛠️ Mục tiêu: Tìm cách giải quyết triệt để vấn đề hot shards và WriteThroughputExceeded trong Kinesis Data Streams, đảm bảo phân bố dữ liệu đều trên các shards để tận dụng tối đa throughput (1 MB/s ghi và 1000 records/s mỗi shard theo tiêu chuẩn AWS cập nhật đến 2026).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Change the partition key from facility ID to a randomly generated key.
Lý do chi tiết:
- Partition key quyết định dữ liệu được hash và phân bổ vào shard nào. Với facility ID, dữ liệu từ các facility lớn sẽ tập trung vào ít shards (hot shards), gây vượt throughput dù stream còn capacity tổng thể.
- Thay bằng randomly generated key (ví dụ: UUID hoặc hash ngẫu nhiên) đảm bảo phân bố đều 100% trên tất cả shards, loại bỏ skew hoàn toàn. Đây là best practice của AWS cho high-throughput streams với dữ liệu không đồng đều (như IoT).
- Kết quả: Giảm WriteThroughputExceeded, tận dụng idle shards, không cần resharding thủ công. Áp dụng ngay mà không downtime (producer thay đổi key trước khi put records).
📋 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 nội dung gốc bằng tiếng Anh. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể dựa trên Kinesis Data Streams provisioning mode (provisioned hoặc on-demand, cập nhật 2024-2026 với auto-scaling shards).
-
✅ Change the partition key from facility ID to a randomly generated key.
Đúng vì: Như giải thích ở trên, đây là giải pháp root cause cho hot shards. AWS khuyến nghị random keys cho workloads skewed (ví dụ: IoT bursts). Không tốn chi phí thêm, scale tự nhiên theo traffic. -
❌ Increase the number of shards.
Sai vì: Tăng shards (quaIncreaseStreamRetentionPeriodhoặcMergeShards/SplitShardsAPI) chỉ tạm thời giảm tải hot shards bằng cách split, nhưng không giải quyết skew. Nếu facility lớn vẫn gửi nhiều data, hot shards mới sẽ hình thành lại. Tốn chi phí (0.015$/shard/giờ) và phức tạp quản lý (cần monitor CloudWatch metrics nhưIncomingBytes/WriteProvisionedThroughputExceeded). -
❌ Archive the data on the producer's side.
Sai vì: Archive (lưu trữ cục bộ ở producer như IoT devices) không liên quan đến throughput Kinesis. Vấn đề là ghi quá nhanh vào stream, không phải lưu trữ lâu dài. Producer vẫn phải put records, và archive chỉ làm chậm data flow, có thể gây buffer overflow ở device. Không giải quyết WriteThroughputExceeded. -
❌ Change the partition key from facility ID to capture date.
Sai vì: Capture date dễ gây temporal skew (skew theo thời gian): Data cùng giờ/phút sẽ hash vào cùng shards, tạo hot shards vào giờ cao điểm (IoT batch reporting). Không đều như random key, đặc biệt với dữ liệu thời gian thực toàn cầu (timezone khác nhau). AWS cảnh báo tránh time-based keys trừ khi kết hợp random.
📘 Tài liệu tham khảo (cập nhật AWS 2026)
- AWS Kinesis Data Streams Developer Guide: Best practices for partition keys - Nhấn mạnh random keys cho even distribution.
- CloudWatch Metrics cho Kinesis:
WriteProvisionedThroughputExceeded,GetRecords.IteratorAgeMillisecondsđể detect hot shards. - Kinesis On-Demand Mode (ra mắt 2021, cập nhật 2025): Auto-scale shards, nhưng vẫn cần good partition key để tránh skew (xem On-Demand docs).
- IoT + Kinesis Best Practices: AWS IoT Analytics với Kinesis.
🛠️ Khuyến nghị thêm: Monitor bằng CloudWatch Contributor Insights để visualize hot partitions. Nếu stream lớn, migrate sang Kinesis Data Firehose cho transformation, hoặc Amazon MSK cho Kafka-like durability.
The data engineer wants to understand the execution plan of a specific SQL statement. The data engineer also wants to see the computational cost of each operation in a SQL query.
Which statement does the data engineer need to run to meet these requirements?
- A EXPLAIN SELECT * FROM sales;
- B EXPLAIN ANALYZE FROM sales;
- C EXPLAIN ANALYZE SELECT * FROM sales;
- D EXPLAIN FROM sales;
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 Amazon Athena – một dịch vụ serverless query trên dữ liệu trong Amazon S3. Một data engineer muốn cải thiện hiệu suất (performance) của các truy vấn SQL trên bảng dữ liệu bán hàng (sales). Cụ thể, họ cần:
- Xem execution plan (kế hoạch thực thi) của một câu lệnh SQL cụ thể: Đây là sơ đồ chi tiết về cách Athena tối ưu hóa và thực hiện query, bao gồm các bước logical plan (kế hoạch logic) và physical plan (kế hoạch vật lý).
- Xem computational cost (chi phí tính toán) của từng operation trong query: Bao gồm thời gian thực thi thực tế, lượng dữ liệu quét (bytes scanned), và các metrics chi phí khác để xác định bottleneck.
🛠️ Để đáp ứng cả hai yêu cầu, data engineer cần chạy một câu lệnh SQL đặc biệt trong Athena. Athena hỗ trợ các lệnh EXPLAIN và EXPLAIN ANALYZE (cập nhật từ phiên bản Athena engine 2 và mới hơn, vẫn áp dụng đến 2026 theo AWS).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: EXPLAIN ANALYZE SELECT * FROM sales;
🧩 Lý do chi tiết:
- Lệnh
EXPLAIN ANALYZEchạy query thực tế (không chỉ mô phỏng), sau đó hiển thị execution plan đầy đủ kèm computational cost của từng operation (như thời gian thực thi, bytes scanned, CPU time, v.v.). - Điều này giúp data engineer phân tích bottleneck chính xác, ví dụ: operation nào tốn nhiều dữ liệu quét nhất để tối ưu partition, columnar format (Parquet/ORC), hoặc thêm materialized views.
- Theo tài liệu AWS mới nhất (2026), đây là cách chuẩn và duy nhất để xem actual runtime stats trong Athena.
📋 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:
-
❌ EXPLAIN SELECT * FROM sales;
Phương án này sai vì chỉ hiển thị execution plan tĩnh (logical + physical plan dự kiến), không chạy query thực tế nên không có computational cost (như bytes scanned thực hoặc thời gian thực thi). Nó hữu ích để xem kế hoạch trước khi chạy, nhưng không đáp ứng yêu cầu xem cost thực tế của từng operation. -
❌ EXPLAIN ANALYZE FROM sales;
Phương án này sai vì cú pháp không hợp lệ. Athena không hỗ trợEXPLAIN ANALYZEmà thiếu mệnh đềSELECT. Lệnh sẽ báo lỗi syntax ngay lập tức, không thực thi được gì. -
✅ EXPLAIN ANALYZE SELECT * FROM sales;
Phương án này đúng như đã giải thích ở trên. Nó kết hợp EXPLAIN (plan) + ANALYZE (chạy thực tế và stats), cung cấp đầy đủ execution plan và computational cost chi tiết (ví dụ: output như "ScanFilterProject: Actual Rows=..., Bytes Scanned=..., Timing=..."). -
❌ EXPLAIN FROM sales;
Phương án này sai vì cú pháp sai (thiếuSELECT). Athena yêu cầuEXPLAINphải theo sau bởi một query hợp lệ nhưSELECT. Lệnh sẽ thất bại và không hiển thị bất kỳ thông tin nào.
📘 Tài liệu tham khảo
- AWS Athena Documentation: Query with EXPLAIN and EXPLAIN ANALYZE (cập nhật 2023-2026, engine version 3+).
- AWS re:Post & Best Practices: Khuyến nghị dùng
EXPLAIN ANALYZEcho performance tuning trên S3 data lakes. - Athena Engine Versions: Engine 3 (mặc định 2026) hỗ trợ đầy đủ stats với columnar stats và improved cost metrics.
Hy vọng phân tích này giúp bạn ôn thi AWS DOP-C02 hiệu quả! 🚀 Nếu cần ví dụ thực tế hoặc query tối ưu, hãy hỏi thêm.
Which solution will meet these requirements with the LEAST operational overhead?
- A Configure an Amazon Kinesis Data Streams data stream to use Splunk as the destination. Create a CloudWatch Logs subscription filter to send log events to the data stream.
- B Create an Amazon Kinesis Data Firehose delivery stream to use Splunk as the destination. Create a CloudWatch Logs subscription filter to send log events to the delivery stream.
- C Create an Amazon Kinesis Data Firehose delivery stream to use Splunk as the destination. Create an AWS Lambda function to send the flow logs from CloudWatch Logs to the delivery stream.
- D Configure an Amazon Kinesis Data Streams data stream to use Splunk as the destination. Create an AWS Lambda function to send the flow logs from CloudWatch Logs to the data stream.
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 việc cấu hình luồng dữ liệu log từ VPC Flow Logs trong AWS. Cụ thể:
- Công ty đã publish VPC Flow Logs trực tiếp vào Amazon CloudWatch Logs (đây là tính năng chuẩn của VPC Flow Logs, cho phép capture traffic flow và lưu trữ logs).
- Yêu cầu: Gửi các flow logs này đến Splunk (một công cụ phân tích log bên thứ ba) ở chế độ near real-time (gần thời gian thực).
- Mục tiêu chính: Giải pháp với LEAST operational overhead (ít nhất công sức vận hành, nghĩa là tự động hóa cao, ít code thủ công, ít quản lý resource).
🛠️ Bối cảnh kỹ thuật:
- VPC Flow Logs capture metadata về IP traffic (như nguồn/đích, port, bytes).
- CloudWatch Logs hỗ trợ subscription filters để stream logs ra ngoài mà không cần polling thủ công.
- Cần tích hợp với Splunk qua HTTP Event Collector (HEC) – Splunk hỗ trợ nhận dữ liệu qua endpoint HTTP.
- Kiến thức cập nhật đến 2026: AWS Kinesis Data Firehose vẫn là lựa chọn tối ưu cho near real-time delivery đến Splunk (tích hợp native từ 2019, không thay đổi cơ bản ở re:Invent 2025). Không có dịch vụ mới thay thế hoàn toàn.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Create an Amazon Kinesis Data Firehose delivery stream to use Splunk as the destination. Create a CloudWatch Logs subscription filter to send log events to the delivery stream.
Lý do:
- ✅ Kinesis Data Firehose hỗ trợ Splunk trực tiếp làm destination (qua HEC endpoint), tự động buffer, transform (nếu cần), và deliver near real-time mà không cần viết code.
- ✅ CloudWatch Logs subscription filter stream logs trực tiếp từ log group đến Firehose mà không cần Lambda hay consumer riêng, giảm overhead tối đa (chỉ config pattern filter và ARN của Firehose).
- 🏆 Least operational overhead: Toàn bộ quy trình serverless, auto-scale, managed retry/error handling. Thời gian setup <5 phút qua Console/CLI/CloudFormation.
📋 Phân tí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. Mỗi phương án được đánh giá đúng/sai với lý do cụ thể:
-
❌ [SAI] Configure an Amazon Kinesis Data Streams data stream to use Splunk as the destination. Create a CloudWatch Logs subscription filter to send log events to the data stream.
Lý do sai: Kinesis Data Streams KHÔNG hỗ trợ Splunk trực tiếp làm destination (Data Streams chỉ stream dữ liệu thô, cần consumer như Lambda/Kinesis Client Library để push tiếp). Subscription filter có thể gửi đến Data Streams, nhưng vẫn phải quản lý consumer riêng → overhead cao hơn Firehose (phải code xử lý batch, scaling shards thủ công). -
✅ [ĐÚNG] Create an Amazon Kinesis Data Firehose delivery stream to use Splunk as the destination. Create a CloudWatch Logs subscription filter to send log events to the delivery stream.
Lý do đúng: Như đã giải thích ở trên. Tích hợp native, subscription filter push trực tiếp logs từ CloudWatch đến Firehose → near real-time (delay <60s), zero code, managed service hoàn toàn. -
❌ [SAI] Create an Amazon Kinesis Data Firehose delivery stream to use Splunk as the destination. Create an AWS Lambda function to send the flow logs from CloudWatch Logs to the delivery stream.
Lý do sai: Dùng Lambda để poll/send từ CloudWatch Logs (qua GetLogEvents API) là cách thủ công, overhead cao (phải schedule Lambda bằng EventBridge, handle pagination/errors, manage concurrency). Subscription filter đã hỗ trợ trực tiếp Firehose → không cần Lambda, giải pháp này dư thừa và phức tạp hơn. -
❌ [SAI] Configure an Amazon Kinesis Data Streams data stream to use Splunk as the destination. Create an AWS Lambda function to send the flow logs from CloudWatch Logs to the data stream.
Lý do sai: Kết hợp hai vấn đề: Data Streams không hỗ trợ Splunk native + Lambda poll thủ công từ CloudWatch → overhead cực cao (code Lambda cho polling + consume shards + push đến Splunk). Không near real-time thực sự, dễ miss logs nếu Lambda throttle.
📘 Tài liệu tham khảo (AWS Docs cập nhật 2026)
- CloudWatch Logs Subscription Filters: docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html → Hỗ trợ Kinesis Data Firehose trực tiếp (ARN format:
arn:aws:firehose:...). - Kinesis Data Firehose to Splunk: docs.aws.amazon.com/firehose/latest/dev/splunk.html → Config HEC token, endpoint Splunk.
- VPC Flow Logs to CloudWatch: docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html → Publish trực tiếp log groups.
- Best Practices DevOps: AWS Well-Architected Framework (Reliability Pillar) khuyến nghị Firehose cho log streaming để minimize overhead (re:Post 2025).
🛠️ Lời khuyên DevOps: Test bằng CloudFormation template cho IaC, monitor metrics như DeliveryToSplunk.Success ở Firehose dashboard!
The company wants to make the data available to data scientists and business analysts. However, the company first needs to manage fine-grained, column-level data access for Athena based on the user roles and responsibilities.
Which solution will meet these requirements?
- A Set up AWS Lake Formation. Define security policy-based rules for the users and applications by IAM role in Lake Formation.
- B Define an IAM resource-based policy for AWS Glue tables. Attach the same policy to IAM user groups.
- C Define an IAM identity-based policy for AWS Glue tables. Attach the same policy to IAM roles. Associate the IAM roles with IAM groups that contain the users.
- D Create a resource share in AWS Resource Access Manager (AWS RAM) to grant access to IAM users.
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 quản lý quyền truy cập dữ liệu tinh vi (fine-grained, column-level data access) trong một data lake trên AWS. Cụ thể:
- Data lake được xây dựng trên Amazon S3 làm lớp lưu trữ, AWS Glue Data Catalog làm kho metadata, và Amazon Athena dùng để query dữ liệu.
- Dữ liệu được ingest từ các business units.
- Yêu cầu: Làm dữ liệu available cho data scientists và business analysts, nhưng phải kiểm soát truy cập ở mức cột (column-level) dựa trên vai trò và trách nhiệm của user (user roles and responsibilities).
- Mục tiêu: Đảm bảo Athena queries chỉ truy cập được các cột dữ liệu phù hợp với từng user/role, tránh leak dữ liệu nhạy cảm.
🛠️ Vấn đề cốt lõi: IAM thông thường chỉ hỗ trợ access ở mức resource (table/database), không đủ fine-grained cho column-level trong Athena trên data lake. Cần giải pháp chuyên biệt cho data lake governance.
📘 Kiến thức cập nhật (tính đến 2026): AWS Lake Formation (ra mắt 2019, cập nhật liên tục) là service chính thức để xây dựng và bảo mật data lakes, hỗ trợ Column-Level Security (CLS) và Cell-Level Security cho Athena, tích hợp Glue Catalog và S3.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Set up AWS Lake Formation. Define security policy-based rules for the users and applications by IAM role in Lake Formation.
Lý do:
- AWS Lake Formation cung cấp fine-grained access control chính xác ở mức database, table, column, và cell-level cho queries từ Athena.
- Bạn có thể define permissions dựa trên IAM roles (permission grants), áp dụng cho users/groups qua role assumption.
- Tích hợp trực tiếp với Glue Catalog (Lake Formation bootstrap Glue để quản lý metadata), và S3 (enforce policies tại query time qua Athena engine).
- Đây là best practice cho data lakes theo AWS Well-Architected Framework (Data Lake pillar, 2024+).
- ✅ Hoàn hảo match yêu cầu: Column-level cho Athena, role-based.
📋 Phân tích tất cả các phương án (đúng/sai)
🧩 Phân tích từng lựa chọn (giữ nguyên văn bản gốc, giải thích bằng tiếng Việt):
-
✅ Đúng:
Set up AWS Lake Formation. Define security policy-based rules for the users and applications by IAM role in Lake Formation.
🛠️ Giải thích: Lake Formation hỗ trợ permissions ở mức granular (column-level) qua LF-Permissions (data lake permissions). Bạn grant access cho IAM principals (users/roles) trên resources (databases/tables/columns). Athena engine enforce tại runtime. Không cần thay đổi IAM policies phức tạp. Đây là giải pháp native, scalable cho data lakes lớn. -
❌ Sai:
Define an IAM resource-based policy for AWS Glue tables. Attach the same policy to IAM user groups.
🛠️ Giải thích: IAM resource-based policies cho Glue tables chỉ hỗ trợ access ở mức table/database, KHÔNG hỗ trợ column-level cho Athena queries. Glue policies chủ yếu cho Data Catalog metadata access, không enforce column filtering trên S3 data. Attach policy vào user groups cũng sai vì resource-based là attach vào resource, không phải group. -
❌ Sai:
Define an IAM identity-based policy for AWS Glue tables. Attach the same policy to IAM roles. Associate the IAM roles with IAM groups that contain the users.
🛠️ Giải thích: IAM identity-based policies (attach vào IAM entities) chỉ cho phép/không cho phép actions nhưglue:GetTable, nhưng KHÔNG hỗ trợ column-level control trong Athena. Athena cần engine-level filtering (như Lake Formation), IAM chỉ coarse-grained. Workflow này phức tạp thừa nhưng vẫn fail yêu cầu fine-grained. -
❌ Sai:
Create a resource share in AWS Resource Access Manager (AWS RAM) to grant access to IAM users.
🛠️ Giải thích: AWS RAM dùng để cross-account resource sharing (như Glue catalogs, S3 buckets), KHÔNG hỗ trợ fine-grained column-level hay IAM users trong cùng account. RAM share resources với principals ngoài account, không phải cho internal role-based column access trong data lake. Không liên quan đến Athena query control.
📚 Tài liệu tham khảo (AWS official, cập nhật 2026)
- AWS Lake Formation Docs: Fine-grained access control & Athena integration.
- AWS Well-Architected Framework - Data Lake Lens (2024): Khuyến nghị Lake Formation cho governance.
- Athena User Guide: Column-level security with Lake Formation.
- Exam Prep: AWS Certified Data Engineer/DevOps Pro (DOP-C02, 2023+ syllabus) nhấn mạnh Lake Formation cho data lakes.
🛡️ Kết luận: Lake Formation là "single source of truth" cho data lake security! Nếu triển khai, dùng Lake Formation console để register S3/Glue, rồi grant permissions. 🚀
The ETL jobs currently process all the data that is in the S3 bucket. However, the company wants the jobs to process only the daily incremental data.
Which solution will meet this requirement with the LEAST coding effort?
- A Create an ETL job that reads the S3 file status and logs the status in Amazon DynamoDB.
- B Enable job bookmarks for the ETL jobs to update the state after a run to keep track of previously processed data.
- C Enable job metrics for the ETL jobs to help keep track of processed objects in Amazon CloudWatch.
- D Configure the ETL jobs to delete processed objects from Amazon S3 after each run.
Xem giải thích
🧩 Giải thích nội dung câu hỏi
Câu hỏi xoay quanh một công ty đang sử dụng AWS Glue ETL jobs để đọc dữ liệu từ Amazon S3 bằng DynamicFrame, sau đó validate, transform và load vào Amazon RDS for MySQL theo batch hàng ngày. Hiện tại, các job này xử lý toàn bộ dữ liệu trong S3 bucket mỗi lần chạy, dẫn đến lãng phí tài nguyên. Yêu cầu là thay đổi để chỉ xử lý dữ liệu incremental hàng ngày (dữ liệu mới thêm vào), đồng thời phải có ít nỗ lực code nhất (LEAST coding effort).
Vấn đề cốt lõi: AWS Glue hỗ trợ Job Bookmarks – một tính năng built-in giúp theo dõi trạng thái dữ liệu đã xử lý từ S3 (như partitions hoặc files), tự động skip data cũ và chỉ process data mới mà không cần viết code phức tạp. Đây là giải pháp tối ưu cho DynamicFrames từ S3. ✅
✅ Đáp án đúng: Enable job bookmarks for the ETL jobs to update the state after a run to keep track of previously processed data.
Lý do lựa chọn:
Job Bookmarks là tính năng native của AWS Glue, được thiết kế chính xác cho trường hợp này. Khi enable, Glue sẽ tự động lưu trạng thái (state) sau mỗi run vào Glue Data Catalog, theo dõi các file/partitions đã xử lý từ S3. Lần chạy sau chỉ process data mới (incremental), đặc biệt hiệu quả với DynamicFrames từ S3. Việc enable chỉ cần cấu hình đơn giản qua AWS Console, CLI hoặc API – không cần code thêm, đáp ứng hoàn hảo "LEAST coding effort". Tính năng này hỗ trợ các định dạng như Parquet, JSON, CSV và cập nhật liên tục đến năm 2026 (phiên bản Glue 4.0+). 🛠️
📋 Phân tí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 ✅ cho đúng và ❌ cho sai, kèm giải thích rõ ràng:
-
Create an ETL job that reads the S3 file status and logs the status in Amazon DynamoDB.
❌ Sai: Phương án này yêu cầu tạo job ETL mới để đọc metadata S3 (như LastModified) và lưu log vào DynamoDB, sau đó dùng logic tùy chỉnh để filter data incremental. Điều này đòi hỏi code phức tạp (ví dụ: sử dụng boto3 SDK, query DynamoDB), quản lý state thủ công, dễ lỗi và không scale tốt. Không phải "LEAST coding effort" vì phải viết script từ đầu. 🗑️ -
Enable job bookmarks for the ETL jobs to update the state after a run to keep track of previously processed data.
✅ Đúng: Như đã giải thích ở trên. Đây là giải pháp built-in, tự động track state qua Glue Catalog, chỉ process data mới từ S3 mà không cần code. Hỗ trợ 3 chế độ: Job, Path, Partition – lý tưởng cho incremental daily. Hoàn hảo cho yêu cầu! 🚀 -
Enable job metrics for the ETL jobs to help keep track of processed objects in Amazon CloudWatch.
❌ Sai: Job metrics (như glue.driver.aggregate.*) chỉ cung cấp metrics giám sát (số records processed, thời gian chạy) trong CloudWatch, không track cụ thể objects/files đã xử lý hay filter incremental data. Không giúp process chỉ data mới, mà chỉ dùng để monitor – phải code thêm logic filter. Không đáp ứng yêu cầu cốt lõi. 📊 -
Configure the ETL jobs to configure the ETL jobs to delete processed objects from Amazon S3 after each run.
❌ Sai: Xóa files sau khi process có thể tạo incremental bằng cách chỉ giữ data mới, nhưng rủi ro cao: mất data vĩnh viễn nếu job fail (không idempotent), vi phạm best practice S3 (immutable storage), và yêu cầu code thêm (s3.delete_objects via boto3). Không an toàn, không phải LEAST effort, và có thể vi phạm compliance. ⚠️
📘 Tài liệu tham khảo (cập nhật đến 2026)
- AWS Glue Job Bookmarks chính thức: AWS Documentation - Track Data Processed by Glue Jobs – Chi tiết cách enable và modes.
- AWS Glue Developer Guide: Processing Incremental Data – Ví dụ code tối thiểu (chỉ --job-bookmark-option).
- AWS Well-Architected Framework (Reliability Pillar): Khuyến nghị dùng Job Bookmarks cho ETL incremental để tránh reprocessing.
- Phiên bản mới nhất: Glue 4.0+ (Spark 3.3, Python 3.10) vẫn hỗ trợ đầy đủ, với cải tiến performance (2024-2026 re:Invent announcements).
Nếu cần demo code hoặc lab thực hành, hãy cho tôi biết nhé! 🌟
Which solution will meet these requirements MOST cost-effectively?
- A Publish flow logs to Amazon CloudWatch Logs. Use Amazon Athena for analytics.
- B Publish flow logs to Amazon CloudWatch Logs. Use an Amazon OpenSearch Service cluster for analytics.
- C Publish flow logs to Amazon S3 in text format. Use Amazon Athena for analytics.
- D Publish flow logs to Amazon S3 in Apache Parquet format. Use Amazon Athena for analytics.
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 thu thập VPC Flow Logs (dữ liệu ghi lại lưu lượng mạng vào/ra của VPC, subnet, ENI) cho ứng dụng chạy trên EC2 instances trong một VPC của công ty bán lẻ trực tuyến, đồng thời phân tích lưu lượng mạng một cách tiết kiệm chi phí nhất (MOST cost-effectively).
- Yêu cầu chính:
- Thu thập flow logs từ VPC.
- Phân tích dữ liệu (analytics) trên flow logs.
- Bối cảnh AWS: VPC Flow Logs hỗ trợ xuất dữ liệu đến CloudWatch Logs hoặc S3 (text hoặc Parquet format từ các phiên bản mới nhất). Phân tích có thể dùng Athena (serverless query trên S3), OpenSearch Service (cluster cho search/analytics).
- Thách thức: Flow logs tạo ra lượng dữ liệu lớn (gigabytes/ngày), nên cần ưu tiên giải pháp rẻ về lưu trữ (storage), ingestion và query costs. Theo cập nhật AWS đến 2026, Parquet format được khuyến nghị cho Athena vì columnar storage và compression cao (giảm 75-90% kích thước dữ liệu so với text).
📘 Tài liệu tham khảo:
- AWS VPC Flow Logs: docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html (hỗ trợ S3 Parquet từ 2021, tối ưu hóa 2024-2026).
- Athena Pricing & Parquet: docs.aws.amazon.com/athena/latest/ug/querying-parquet.html (scan data $5/TB, Parquet giảm scan đáng kể).
- Pricing so sánh: aws.amazon.com/vpc/pricing/ và aws.amazon.com/athena/pricing/.
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Publish flow logs to Amazon S3 in Apache Parquet format. Use Amazon Athena for analytics.
Lý do 🛠️:
- Tiết kiệm chi phí cao nhất: S3 storage rẻ nhất (~$0.023/GB/tháng), Parquet format nén columnar (giảm 75-90% dung lượng so text), Athena chỉ charge $5/TB dữ liệu scan thực tế → query nhanh, rẻ cho dữ liệu lớn.
- Tối ưu hiệu suất: Athena tự partition flow logs theo thời gian (year/month/day/hour), kết hợp Parquet columnar pruning → scan ít dữ liệu.
- Serverless & scalable: Không cần quản lý cluster, phù hợp online retail với traffic biến động.
- So với các option khác: Tránh CloudWatch Logs (ingestion $0.50/GB + storage $0.03/GB), OpenSearch (EC2 instance tốn kém), text format (scan toàn bộ → query đắt).
📋 Phân tích tất cả các phương án (đúng/sai)
-
❌ Publish flow logs to Amazon CloudWatch Logs. Use Amazon Athena for analytics.
Sai vì: CloudWatch Logs có chi phí ingestion cao ($0.50/GB đầu vào + $0.03/GB lưu trữ), Athena query trên CW Logs cần export sang S3 trước (thêm phí + độ trễ). Không cost-effective cho dữ liệu lớn như flow logs. -
❌ Publish flow logs to Amazon CloudWatch Logs. Use an Amazon OpenSearch Service cluster for analytics.
Sai vì: CloudWatch Logs đã đắt, cộng thêm OpenSearch cluster yêu cầu EC2 instances (chi phí instance hours ~$0.1-1/giờ + storage), không serverless. Phù hợp real-time search nhưng quá tốn kém cho analytics lưu lượng mạng. -
❌ Publish flow logs to Amazon S3 in text format. Use Amazon Athena for analytics.
Sai vì: S3 rẻ storage ($0.023/GB), nhưng text format không nén (kích thước lớn 4-10x Parquet), Athena scan toàn bộ cột không cần thiết → chi phí query cao ($5/TB scan). Không tối ưu columnar cho analytics phức tạp. -
✅ Publish flow logs to Amazon S3 in Apache Parquet format. Use Amazon Athena for analytics.
Đúng vì: Kết hợp hoàn hảo - S3 + Parquet (nén cao, columnar), Athena partition tự động + query hiệu quả → tổng chi phí thấp nhất (storage + scan giảm 80%). AWS best practice cho VPC Flow Logs analytics lớn (cập nhật 2026).
The company updates the store location table only once or twice every few years.
A data engineer notices that Redshift queues are slowing down because the whole store location table is constantly being broadcast to all four compute nodes for most queries. The data engineer wants to speed up the query performance by minimizing the broadcasting of the store location table.
Which solution will meet these requirements in the MOST cost-effective way?
- A Change the distribution style of the store location table from EVEN distribution to ALL distribution.
- B Change the distribution style of the store location table to KEY distribution based on the column that has the highest dimension.
- C Add a join column named store_id into the sort key for all the tables.
- D Upgrade the Redshift reserved node to a larger instance size in the same instance family.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi xoay quanh một công ty bán lẻ lưu trữ dữ liệu trong Amazon Redshift cluster gồm 4 reserved nodes ra3.4xlarge. Các bảng chính bao gồm transactions (giao dịch), store locations (vị trí cửa hàng), và customer information (thông tin khách hàng), tất cả đều sử dụng even distribution style (phân bố đều dữ liệu lên các compute nodes).
🔍 Vấn đề cụ thể:
- Bảng store locations chỉ được cập nhật rất hiếm (1-2 lần mỗi vài năm), ngụ ý đây là bảng nhỏ và ít thay đổi.
- Data engineer nhận thấy hàng đợi (queues) chậm vì bảng store locations bị broadcast toàn bộ đến tất cả 4 compute nodes trong hầu hết các query. Điều này xảy ra do Redshift optimizer thường broadcast bảng nhỏ (small table) khi join với các bảng lớn có even distribution, dẫn đến overhead cao về network và I/O.
- Mục tiêu: Tăng tốc query bằng cách giảm thiểu broadcast bảng store locations, đồng thời chọn giải pháp cost-effective nhất (tiết kiệm chi phí nhất).
🛠️ Ngữ cảnh kỹ thuật (dựa trên Redshift phiên bản mới nhất 2026):
- Redshift sử dụng distribution styles để quyết định cách dữ liệu được phân bố trên compute nodes: EVEN (đều), KEY (dựa cột), ALL (sao chép toàn bộ).
- Với RA3 nodes (managed storage), broadcast gây chậm do network traffic giữa leader và compute nodes.
- Giải pháp cần tránh chi phí nâng cấp hardware hoặc thay đổi lớn.
📘 Tài liệu tham khảo:
- AWS Redshift Documentation: Choosing the best distribution style (cập nhật 2025).
- Redshift query optimization best practices (bao gồm broadcast avoidance).
✅ Đáp án đúng và lý do lựa chọn
Đáp án đúng: Change the distribution style of the store location table from EVEN distribution to ALL distribution.
Lý do chi tiết:
- ALL distribution sao chép toàn bộ bảng store locations lên mọi compute node ngay từ đầu. Khi query join với các bảng khác (như transactions hoặc customer), Redshift thực hiện local join trên từng node mà KHÔNG cần broadcast, giảm đáng kể network traffic và tăng tốc query lên đến hàng chục lần cho các join thường xuyên.
- Bảng này nhỏ + ít cập nhật (chỉ 1-2 lần/năm), nên chi phí lưu trữ duplicate thấp (RA3 tách storage riêng, scale độc lập).
- Cost-effective nhất: Chỉ cần ALTER TABLE (không tốn phí node, không downtime lớn), khác với nâng cấp instance hay thay đổi nhiều bảng.
- Trong Redshift 2026, ALL style vẫn là best practice cho dimension tables nhỏ (< vài triệu rows).
📋 Phân tích tất cả các phương án (đúng/sai)
-
✅ Change the distribution style of the store location table from EVEN distribution to ALL distribution.
Đúng vì: Như giải thích trên, trực tiếp loại bỏ broadcast bằng cách pre-copy bảng nhỏ lên tất cả nodes. Lý tưởng cho fact-dimension joins, tuân thủ best practices AWS. 🚀 -
❌ Change the distribution style of the store location table to KEY distribution based on the column that has the highest dimension.
Sai vì: KEY distribution phân bố dựa trên một cột (e.g., store_id), chỉ hiệu quả nếu tất cả bảng join cùng dùng cột đó làm dist key. Ở đây, các bảng khác vẫn EVEN, nên Redshift vẫn broadcast nếu không co-located, không giải quyết triệt để. "Highest dimension" không chuẩn thuật ngữ Redshift. 🧐 -
❌ Add a join column named store_id into the sort key for all the tables.
Sai vì: Sort key (compound/interleaved) cải thiện zone maps + compression để prune data trong query (e.g., range scans), nhưng KHÔNG ảnh hưởng distribution hay broadcast. Broadcast vẫn xảy ra do even dist mismatch. Phải thay đổi tất cả 3 bảng → tốn công, không cost-effective. 🔄 -
❌ Upgrade the Redshift reserved node to a larger instance size in the same instance family.
Sai vì: Tăng CPU/RAM (e.g., ra3.8xlarge) chỉ giúp xử lý broadcast nhanh hơn, KHÔNG loại bỏ broadcast gốc rễ. Với reserved nodes, nâng cấp tốn kém cao (double chi phí), vi phạm "MOST cost-effective". Không phải giải pháp tối ưu theo AWS. 💰
Which SQL query will meet this requirement?
- A Select * from Sales where city_name ~ ‘$(San|El)*’;
- B Select * from Sales where city_name ~ ‘^(San|El)*’;
- C Select * from Sales where city_name ~’$(San&El)*’;
- D Select * from Sales where city_name ~ ‘^(San&El)*’;
Xem giải thích
🧩 Giải thích chi tiết nội dung câu hỏi
Câu hỏi xoay quanh việc query dữ liệu trong Amazon Redshift – một dịch vụ data warehouse serverless của AWS, sử dụng engine dựa trên PostgreSQL 8.0.2 với hỗ trợ POSIX regular expression (regex) qua các operator như ~ (match case-sensitive).
Bảng Sales có cột city_name (kiểu STRING). Yêu cầu: Truy xuất TẤT CẢ các hàng (rows) mà giá trị city_name BẮT ĐẦU bằng chuỗi "San" HOẶC "El" (ví dụ: "San Francisco", "El Paso", "San Diego", nhưng KHÔNG phải "New York" hay "Los Angeles" vì không bắt đầu đúng).
🔑 Yêu cầu regex chính xác:
- Sử dụng
~để kiểm tra prefix match (bắt đầu chuỗi). - Anchor
^để neo đầu chuỗi. |cho OR (San hoặc El).- Không cần
$(end anchor) vì chỉ kiểm tra prefix, phần sau có thể là bất kỳ.
Lưu ý cập nhật 2026: Redshift (phiên bản mới nhất RA3/RA3.16xlarge hoặc serverless) vẫn giữ nguyên syntax regex POSIX từ Postgres, không thay đổi lớn (xem AWS docs). Không sử dụng LIKE 'San%' OR LIKE 'El%' vì câu hỏi yêu cầu regex ~.
📘 Tài liệu tham khảo:
- AWS Redshift Regex Operators
- Redshift Pattern Matching
- Postgres regex docs (base của Redshift): POSIX Regex
✅ Đáp án đúng
Select * from Sales where city_name ~ ‘^(San|El)*’;
Lý do lựa chọn 🛠️:
^: Anchor chính xác đầu chuỗi (starts with), đảm bảo match chỉ từ vị trí đầu tiên.(San|El): Nhóm alternation|đại diện cho OR – match "San" HOẶC "El".*: Kleene star, cho phép zero hoặc nhiều lần lặp của group(San|El), giúp match các chuỗi như "San..." hoặc "El..." (và linh hoạt với phần sau). Đây là syntax phù hợp nhất trong các lựa chọn để đáp ứng yêu cầu starts with "San" hoặc "El".- Toàn bộ pattern ‘^(San|El)*’ sẽ filter đúng các rows cần thiết trong Redshift.
❌ 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, giữ nguyên văn bản gốc tiếng Anh. Phân tích lý do đúng/sai dựa trên quy tắc POSIX regex trong Redshift:
-
Select * from Sales where city_name ~ ‘$(San|El)*’; ❌ SAI
🧩$là anchor cuối chuỗi (end of string), nên pattern kiểm tra xem chuỗi KẾT THÚC bằng(San|El)*thay vì bắt đầu. Ví dụ: "FranciscoSan" có thể match nếu end đúng, nhưng không filter đúng "starts with". Thêm nữa,$+*zero-length thường match không chính xác yêu cầu prefix. Không đáp ứng. -
Select * from Sales where city_name ~ ‘^(San|El)*’; ✅ ĐÚNG
🛠️ Như giải thích trên:^neo đầu,|cho OR,*hỗ trợ lặp prefix – hoàn hảo cho starts with "San" hoặc "El" theo sau bất kỳ. Test ví dụ: "San Francisco" ✅ match, "El Paso" ✅, "New York" ❌ (không bắt đầu đúng). -
Select * from Sales where city_name ~’$(San&El)*’; ❌ SAI
🧩 Hai lỗi: (1)$anchor cuối chuỗi (wrong cho starts with). (2)&El(HTML decode là&El) –&KHÔNG phải operator OR (|mới là OR), mà là ký tự literal "&" trong POSIX regex. Pattern thành(San&El)*nghĩa là lặp "San&El" ở cuối – hoàn toàn sai ý nghĩa "San HOẶC El". Không match gì liên quan. -
Select * from Sales where city_name ~ ‘^(San&El)*’; ❌ SAI
🛠️^đúng (đầu chuỗi),*ok syntax, NHƯNG&El(=&El) sai như trên:&không phải OR, pattern chỉ match lặp "San&El" ở đầu (ví dụ "San&ElSan&El..." mới match). Không bao quát "San..." hoặc "El...". Syntax regex invalid cho yêu cầu.
💡 Mẹo DevOps: Trong thực tế, test query trên Redshift console hoặc dùng EXPLAIN để verify performance. Nếu scale lớn, partition bảng theo city_name prefix để tối ưu! 🚀
A data engineer configures an AWS Database Migration Service (AWS DMS) ongoing replication task. The task reads changes in near real time from the PostgreSQL source database transaction logs for each table. The task then sends the data to an Amazon Redshift cluster for processing.
The data engineer discovers latency issues during the change data capture (CDC) of the task. The data engineer thinks that the PostgreSQL source database is causing the high latency.
Which solution will confirm that the PostgreSQL database is the source of the high latency?
- A Use Amazon CloudWatch to monitor the DMS task. Examine the CDCIncomingChanges metric to identify delays in the CDC from the source database.
- B Verify that logical replication of the source database is configured in the postgresql.conf configuration file.
- C Enable Amazon CloudWatch Logs for the DMS endpoint of the source database. Check for error messages.
- D Use Amazon CloudWatch to monitor the DMS task. Examine the CDCLatencySource metric to identify delays in the CDC from the source database.
Xem giải thích
🧩 Phân tích chi tiết nội dung câu hỏi
Câu hỏi xoay quanh tình huống một công ty cần chuyển dữ liệu cuộc gọi khách hàng từ cơ sở dữ liệu PostgreSQL on-premises sang AWS để tạo insights gần thời gian thực (near real-time). Giải pháp sử dụng AWS Database Migration Service (AWS DMS) với ongoing replication task để thực hiện Change Data Capture (CDC) – tức là capture và load các thay đổi liên tục từ transaction logs của PostgreSQL source database vào Amazon Redshift.
📊 Vấn đề chính: Data engineer phát hiện latency cao trong quá trình CDC của DMS task, và nghi ngờ PostgreSQL source database là nguyên nhân. Câu hỏi yêu cầu giải pháp xác nhận chắc chắn rằng PostgreSQL chính là nguồn gây latency cao (không phải các phần khác như DMS task hay target).
🛠️ Bối cảnh kỹ thuật (dựa trên AWS DMS phiên bản mới nhất 2024-2026):
- DMS hỗ trợ CDC cho PostgreSQL qua logical replication (sử dụng pglogical hoặc native logical decoding).
- Latency trong CDC có thể do source DB (transaction log chậm), DMS replication instance (xử lý chậm), hoặc network/target.
- Để xác nhận source gây latency, cần metric đo thời gian trễ từ source đến DMS (không phải logs hay config chung).
✅ Đáp án đúng
Use Amazon CloudWatch to monitor the DMS task. Examine the CDCLatencySource metric to identify delays in the CDC from the source database.
Lý do chọn đáp án này (🟢 Hoàn toàn chính xác):
Metric CDCLatencySource trong Amazon CloudWatch dành riêng cho DMS task, đo latency từ source endpoint (PostgreSQL) đến replication instance của DMS. Giá trị cao (> vài giây) xác nhận PostgreSQL gây trễ (ví dụ: transaction log đọc chậm do I/O cao, CPU overload). Đây là cách trực tiếp và chuẩn xác nhất để isolate vấn đề source, theo docs AWS DMS mới nhất. Không cần config thêm, chỉ monitor task là đủ.
🔍 Phân tích tất cả các phương án (đúng/sai)
-
❌ Use Amazon CloudWatch to monitor the DMS task. Examine the CDCIncomingChanges metric to identify delays in the CDC from the source database.
Sai vì: Metric CDCIncomingChanges không tồn tại trong CloudWatch DMS metrics (danh sách chuẩn chỉ có CDCChangesMemorySource/DiskSource cho số lượng changes, không đo latency). Không giúp xác nhận source gây delay, chỉ theo dõi throughput changes – dễ nhầm lẫn với metrics khác như CDCChanges. -
❌ Verify that logical replication of the source database is configured in the postgresql.conf configuration file.
Sai vì: Kiểm tra configwal_level = logical,max_replication_slots,max_wal_senderstrong postgresql.conf là bước setup ban đầu cần thiết cho DMS CDC với PostgreSQL, nhưng không đo lường latency. Nếu config sai, DMS task sẽ fail ngay từ đầu (không ongoing), không phải latency cao. Đây chỉ là troubleshooting config, không confirm source gây delay. -
❌ Enable Amazon CloudWatch Logs for the DMS endpoint of the source database. Check for error messages.
Sai vì: CloudWatch Logs cho DMS endpoint ghi errors/warnings (như connection fail, slot issues), không đo latency quantitative. Latency cao có thể không có error explicit, chỉ là performance chậm – logs chỉ qualitative, không isolate source cụ thể (có thể do network/DMS). -
✅ Use Amazon CloudWatch to monitor the DMS task. Examine the CDCLatencySource metric to identify delays in the CDC from the source database.
Đúng vì: Như giải thích trên, metric này chính xác đo delay từ PostgreSQL source (timestamp change ở source vs. khi DMS nhận). Threshold >1-5s tùy workload confirm vấn đề. So sánh với CDCLatencyTarget để loại trừ target Redshift.
📘 Tài liệu tham khảo (AWS docs mới nhất 2024-2026)
- AWS DMS Monitoring with CloudWatch Metrics – Chi tiết CDCLatencySource (Namespace: AWS/DMS, Dimensions: ReplicationInstanceIdentifier, ReplicationTaskIdentifier).
- DMS CDC for PostgreSQL – Endpoint settings và logical replication.
- Troubleshooting DMS Latency – Khuyến nghị dùng CDCLatencySource.
🛡️ Lời khuyên DevOps: Để tối ưu, enable DMS Performance Insights + CloudWatch alarms trên CDCLatencySource > 5s, và scale PostgreSQL WAL retention nếu cần. Nếu latency persist, check source DB metrics (pg_stat_replication)!