Pipelines & choices Pipeline & lựa chọn

The join-the-dots page. Individual services are on their own pages; this one is the shapes they form together — how to run a job, how the analytics layer stacks up, what a full ingestion pipeline looks like end to end, and how to pick between EMR, Athena and Redshift when a question offers all three.

Trang nối các mảnh lại. Từng service có trang riêng; trang này là những hình dạng chúng tạo ra khi ghép với nhau — chạy một job bằng cách nào, tầng analytics xếp ra sao, một pipeline ingestion đầy đủ trông thế nào, và chọn EMR / Athena / Redshift ra sao khi đề đưa cả ba.

1 · Running jobs on AWS1 · Chạy job trên AWS

Six ways to make code run without a user waiting on it. They differ on two axes only: what starts the job (a clock, an event, a person) and how long it runs (milliseconds, minutes, hours). Sáu cách để code chạy mà không có ai ngồi chờ. Chúng chỉ khác nhau ở hai trục: cái gì khởi động job (đồng hồ, event, con người) và chạy bao lâu (mili giây, phút, giờ).

Six strategies for running jobs on AWS — EC2 cron, EventBridge with Lambda, reactive Lambda, AWS Batch, Fargate and EMR 1 · Provision an EC2 instance EC2 long-running host · CRON jobs · you patch it 2 · EventBridge + Lambda EventBridge Lambda cron schedule · the serverless default 3 · Reactive workflow S3 · API GW · SQS · SNS Lambda an event happened, not a clock 4 · AWS Batch EventBridge Batch containers · no time limit · Spot-friendly 5 · Fargate EventBridge Fargate task one container, no queue, no cluster 6 · EMR EMR step or cluster only when the job needs Hadoop / Spark

Reading order is roughly "cheapest and simplest first". EventBridge is the trigger in three of the six — it is the cron of AWS.

Thứ tự đọc gần như là "rẻ và đơn giản trước". EventBridge là bộ kích hoạt trong ba trên sáu cách — nó chính là cron của AWS.

  • Strategy 1 — provision an EC2 instance (long running, CRON jobs). The pre-cloud answer: it works, but you own patching, scaling and the idle bill.Cách 1 — dựng một EC2 instance (chạy dài, CRON job). Đáp án kiểu tiền-cloud: chạy được, nhưng bạn gánh việc vá lỗi, scale và tiền lúc máy ngồi không.
  • Strategy 2 — Amazon EventBridge + Lambda (cron): a schedule rule invokes a function. The default for anything short and periodic.Cách 2 — Amazon EventBridge + Lambda (cron): một rule theo lịch gọi function. Mặc định cho mọi thứ ngắn và lặp lại.
  • Strategy 3 — reactive workflow: EventBridge, S3 events, API Gateway, SQS, SNS… → Lambda. Started by something happening, not by a clock.Cách 3 — workflow phản ứng: EventBridge, S3 event, API Gateway, SQS, SNS… → Lambda. Được khởi động vì có việc xảy ra, không phải vì tới giờ.
  • Strategy 4 — AWS Batch: for jobs that exceed Lambda (time, runtime, disk) and come in volume.Cách 4 — AWS Batch: cho job vượt giới hạn Lambda (thời gian, runtime, disk) và có số lượng lớn.
  • Strategy 5 — Fargate: EventBridge starts a single container task. Batch without the queue, for when there's just one job.Cách 5 — Fargate: EventBridge khởi chạy một container task đơn lẻ. Batch mà không cần queue, khi chỉ có một job.
  • Strategy 6 — EMR (step execution or a cluster): only when the work genuinely needs the Hadoop ecosystem.Cách 6 — EMR (chạy step hoặc cả cluster): chỉ khi công việc thật sự cần hệ sinh thái Hadoop.

2 · The analytics layer2 · Tầng analytics

From S3, data can go to EMR for big-data tools, Redshift for warehousing or Athena for serverless SQL, and Redshift and Athena feed QuickSight for visualisation Amazon S3 the data lake Amazon EMR Hadoop / Spark / Hive… Redshift · Spectrum data warehousing Amazon Athena serverless SQL QuickSight visualization EMR output usually goes back to S3 first

One lake, three engines, one dashboard tool. The engine is a choice about how you query — the storage and the visualisation stay the same.

Một data lake, ba engine, một công cụ dashboard. Chọn engine chỉ là chọn cách query — chỗ lưu và chỗ hiển thị vẫn vậy.

3 · A full ingestion pipeline3 · Một pipeline ingestion đầy đủ

IoT devices stream into Kinesis Data Streams and Firehose, land in an ingestion bucket, are processed by Lambda and Athena, and the results in a reporting bucket feed QuickSight real-time every 1 minute IoT devices Kinesis Data Streams Firehose Amazon S3 ingestion bucket Lambda transform pull data SQS optional Lambda trigger Athena Amazon S3 reporting bucket QuickSight Amazon Redshift not serverless

Top row ingests, bottom row processes (right to left), and the output drops into QuickSight. Every box is a page on this site.

Hàng trên là ingest, hàng dưới là xử lý (chạy từ phải sang trái), kết quả rơi xuống QuickSight. Mỗi ô đều có một trang riêng trên site này.

  • Kinesis Data Streams takes the real-time feed; Firehose batches it and writes to S3 roughly every minute — that one-minute buffer is the difference between "real-time" and "near real-time" in the exam.Kinesis Data Streams nhận luồng real-time; Firehose gom lại và ghi xuống S3 khoảng mỗi phút — cái buffer một phút đó chính là ranh giới giữa "real-time" và "near real-time" trong đề thi.
  • A Lambda attached to Firehose transforms records on the way through (clean, reformat, drop fields) — different from the Lambda further down the pipeline.Lambda gắn vào Firehose biến đổi record ngay trên đường đi (làm sạch, đổi format, bỏ field) — khác với Lambda ở phía sau pipeline.
  • SQS is optional: put it between S3 events and Lambda when you want buffering, retries and a dead-letter queue instead of a direct notification.SQS là tuỳ chọn: đặt giữa S3 event và Lambda khi cần đệm, retry và dead-letter queue thay vì gọi thẳng.
  • Lambda triggers Athena; Athena pulls from the ingestion bucket and writes results to the reporting bucket. Two buckets, two jobs — cheap dashboards read the small one.Lambda kích hoạt Athena; Athena kéo data từ bucket ingestion và ghi kết quả sang bucket reporting. Hai bucket, hai vai trò — dashboard rẻ vì chỉ đọc bucket nhỏ.
  • Redshift can also feed QuickSight, but note the label: it is not serverless, so it only earns its place when the query load is sustained.Redshift cũng có thể nuôi QuickSight, nhưng để ý nhãn: nó không serverless, nên chỉ đáng dùng khi tải query đều đặn.

4 · Choosing a warehousing technology4 · Chọn công nghệ warehousing

When a question offers EMR, Athena and Redshift as three of the four options, it is really asking one thing: do you need Hadoop tools, do you need advanced SQL, or do you need to run nothing at all? Khi đề đưa EMR, Athena và Redshift làm ba trong bốn đáp án, thực chất nó chỉ hỏi một điều: bạn cần công cụ Hadoop, cần SQL nâng cao, hay cần không phải nuôi gì cả?

EMR Athena Redshift
Pick it whenChọn khi You need Big Data tools — Apache Hive, SparkBạn cần công cụ Big Data — Apache Hive, Spark Simple queries and aggregations, data must live in S3Query và tổng hợp đơn giản, data phải nằm trên S3 Advanced SQL queriesQuery SQL nâng cao
What you runBạn phải nuôi gì One long-running cluster with auto-scaling for many jobs, or one cluster per jobMột cluster chạy dài có auto-scaling cho nhiều job, hoặc mỗi job một cluster Serverless — nothingServerless — không gì cả Must provision serversPhải provision server
Cost controlKiểm soát chi phí Purchasing options — Spot, On-Demand, ReservedLựa chọn mua — Spot, On-Demand, Reserved Per TB scanned — optimise the filesTheo TB quét — tối ưu file Node-hours; Reserved for steady loadNode-giờ; Reserved cho tải đều
Data accessTruy cập data Can access data in DynamoDB and / or S3Đọc được data ở DynamoDB và / hoặc S3 Out-of-the-box queries for many services (cost & billing…)Có sẵn query cho nhiều dịch vụ (cost & billing…) Loaded tables; Redshift Spectrum for serverless queries on S3Bảng đã load; Redshift Spectrum để query serverless trên S3
Storage noteGhi chú storage Scratch data on EBS disks (HDFS), long-term storage in S3 (EMRFS)Data tạm trên đĩa EBS (HDFS), lưu trữ dài hạn trên S3 (EMRFS) Nothing to store — audit queries through CloudTrailKhông lưu gì — kiểm toán query qua CloudTrail Managed cluster storageStorage do cluster quản

Exam reflexesPhản xạ khi thi

  • "Run this every night" → EventBridge + (Lambda if short · Batch/Fargate if not). Not a cron on an EC2 box."Chạy cái này mỗi đêm" → EventBridge + (Lambda nếu ngắn · Batch/Fargate nếu không). Đừng chọn cron trên một máy EC2.
  • "Cheapest end-to-end analytics on S3 data" → Athena + QuickSight, no cluster anywhere in the answer."Analytics đầu-cuối rẻ nhất trên data S3" → Athena + QuickSight, đáp án không có cluster nào.
  • "Near real-time dashboard from devices" → KDS → Firehose (1-minute buffer) → S3 → Athena → QuickSight."Dashboard gần real-time từ thiết bị" → KDS → Firehose (buffer 1 phút) → S3 → Athena → QuickSight.
  • Three warehouse options in one question → match the verb: "Spark/Hive" = EMR, "serverless / occasional" = Athena, "complex joins, sustained" = Redshift.Ba đáp án warehouse trong một câu → bắt theo động từ: "Spark/Hive" = EMR, "serverless / thi thoảng" = Athena, "join phức tạp, chạy đều" = Redshift.
  • "Query S3 from Redshift without loading" → Redshift Spectrum, and it still needs a running cluster."Query S3 từ Redshift mà không load" → Redshift Spectrum, và vẫn cần một cluster đang chạy.