Where events goEvent đi về đâu

Every "trigger X when Y happens" question is really two questions: what kind of thing changed, and which pipe does that service already speak. AWS doesn't have one event system — it has several generations of them, and each feature is wired to whichever pipe existed when it shipped. Sort the change first; the pipe follows.

Mọi câu hỏi kiểu "kích hoạt X khi Y xảy ra" thật ra là hai câu hỏi: cái gì đã thay đổi, và service đó vốn đã nói chuyện qua đường ống nào. AWS không có một hệ thống event duy nhất — nó có nhiều thế hệ, và mỗi tính năng được nối vào đường ống tồn tại vào lúc nó ra đời. Phân loại thay đổi trước; đường ống tự khắc ra.

At a glanceNhìn một hình

Summary in three bands: control-plane changes from EC2, CloudTrail, CloudWatch alarms and RDS instances go to EventBridge; the services' own notify settings for S3, CloudWatch alarm actions and RDS event subscriptions go to SNS, SQS or Lambda; data-plane changes from DynamoDB items, CloudWatch log lines and RDS rows go to streams WHAT CHANGED PIPE WHO ACTS CONTROL PLANE — the service emits it, nothing to set up EC2 · ECS · Batch state change CloudTrail any API call · needs a trail CloudWatch alarm state flip ALARM ↔ OK RDS · Aurora instance event: failover, reboot EventBridge free · no setup rules → ≤ 5 targets IAM / Orgs: us-east-1 Lambda · SQS · SNS · acct B THE SERVICE'S OWN NOTIFY SETTING — older door, still valid S3 object event notification · no FIFO CloudWatch alarm action same alarm, older door RDS event subscription same events as the bus SNS push · fan-out or straight to SQS / λ stores nothing people · SQS ×N · Lambda DATA PLANE — the data itself, too much volume for the bus DynamoDB item Streams 24 h · never on the bus CloudWatch Logs line subscription filter RDS row no native hook → DMS CDC Streams ordered · replayable Kinesis · DDB Streams consumers poll Lambda ESM · Firehose → S3 green = works out of the box · orange = the catch · one service can sit in several bands — it depends on WHAT changed

Three bands, three doors. The same service can sit in more than one band — CloudWatch and RDS appear in all three — because the pipe depends on what changed, not on which service it is.

Ba dải, ba cánh cửa. Cùng một service có thể nằm ở nhiều dải — CloudWatch và RDS xuất hiện ở cả ba — vì đường ống phụ thuộc vào cái gì thay đổi, không phải service nào.

EventBridge is the answerEventBridge là đáp án

  • EC2 / ECS task / Batch job / Step Functions execution changed state.EC2 / ECS task / Batch job / Step Functions execution đổi trạng thái.
  • A security finding appeared — GuardDuty, Inspector, Macie, Security Hub.Có finding bảo mật — GuardDuty, Inspector, Macie, Security Hub.
  • Someone did something — disabled CloudTrail, opened a security group, created an IAM user.Ai đó làm gì đó — tắt CloudTrail, mở security group, tạo IAM user.
  • AWS does something to you — Health scheduled change, Spot interruption, cert expiring.AWS làm gì đó với bạn — Health scheduled change, Spot interruption, cert sắp hết hạn.
  • Cron / rate schedules, or routing one event to many target types or another account.Lịch cron / rate, hoặc định tuyến một event tới nhiều loại target hay account khác.

Something else is the answerĐáp án là thứ khác

  • Every DynamoDB item change → DynamoDB Streams + Lambda.Mỗi thay đổi item DynamoDB → DynamoDB Streams + Lambda.
  • Every RDS row change → DMS CDC → Kinesis (RDS has no change stream).Mỗi thay đổi row RDS → DMS CDC → Kinesis (RDS không có change stream).
  • Every log line in real time → subscription filter → Kinesis / Firehose / Lambda.Mỗi dòng log theo thời gian thực → subscription filter → Kinesis / Firehose / Lambda.
  • A number crossed a threshold → CloudWatch alarm. The bus only sees the alarm flip, never the datapoints.Một con số vượt ngưỡng → CloudWatch alarm. Bus chỉ thấy alarm đổi trạng thái, không bao giờ thấy datapoint.
  • Thousands of records per second, ordered, replayable → Kinesis Data Streams.Hàng nghìn bản ghi mỗi giây, có thứ tự, phát lại được → Kinesis Data Streams.

1 · Four kinds of change, four ways out1 · Bốn kiểu thay đổi, bốn lối ra

Before thinking about SNS vs EventBridge vs Kinesis, ask what changed. The same service can emit all four kinds — an RDS instance has a state (failover), an API (ModifyDBInstance), data (rows) and an old SNS setting — and each one leaves through a different door. Trước khi nghĩ SNS hay EventBridge hay Kinesis, hãy hỏi cái gì đã thay đổi. Cùng một service có thể phát ra cả bốn kiểu — một RDS instance có trạng thái (failover), có API (ModifyDBInstance), có dữ liệu (row) và có ô cài SNS đời cũ — và mỗi kiểu đi ra bằng một cửa khác nhau.

Four kinds of change and where each goes: resource state changes go straight to the EventBridge default bus; API calls go through CloudTrail to EventBridge; data changes go to each service's own hook; legacy notify settings go to an SNS topic WHAT CHANGED GOES THROUGH LANDS IN 1 · a resource's STATE instance stopped · task STOPPED job FAILED · alarm → ALARM GuardDuty finding · Health event the service emits it source: aws.ec2 · aws.ecs … EventBridge · default bus free · nothing to switch on rule matches → up to 5 targets Lambda · SNS · SQS · SFN · SSM 2 · someone called an API CreateUser · PutBucketPolicy StopLogging · DeleteTrail AuthorizeSecurityGroupIngress CloudTrail trail must be logging EventBridge · default bus detail-type: AWS API Call via CloudTrail IAM, Orgs → us-east-1 only 3 · the DATA itself object PUT · item UPDATE log line written · DB row IoT message · Kafka record the service's own hook too much volume for the bus data-plane hook S3 Event Notifications DynamoDB Streams · Logs subscr. IoT rules · DMS CDC → Kinesis 4 · a "notify me" setting RDS failover · ASG launch stack CREATE_FAILED budget passed 80 % topic ARN on the resource older than EventBridge SNS topic → email · SMS · HTTPS → SQS · Lambda · Firehose same event often on row 1 too

Rows 1, 2 and 4 are control-plane events — a handful per hour, about the resource. Row 3 is the data — thousands per second is normal — so it never rides the shared bus unless you opt in; each service ships its own hook. Row 4 is usually row 1 again, through an older door.

Hàng 1, 2, 4 là event control-plane — vài cái mỗi giờ, nói về tài nguyên. Hàng 3 là dữ liệu — hàng nghìn mỗi giây là bình thường — nên không bao giờ đi chung bus trừ khi bạn chủ động bật; mỗi service có cái móc riêng. Hàng 4 thường chính là hàng 1, đi qua một cánh cửa đời cũ hơn.

  • Control plane vs data plane: control plane = managing the resource (create, stop, resize, fail over). Data plane = using it (put an object, write an item, run a query). The bus is built for the first; the second has dedicated streams.Control plane và data plane: control plane = quản lý tài nguyên (tạo, dừng, đổi size, failover). Data plane = sử dụng nó (put object, ghi item, chạy query). Bus được thiết kế cho cái đầu; cái sau có stream riêng.
  • CloudTrail → EventBridge delivers write management calls by default. Read-only calls (Get / List / Describe) need the rule state ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS; data events (e.g. S3 GetObject) need the trail to record them first.CloudTrail → EventBridge mặc định chỉ gửi các lệnh management kiểu ghi. Lệnh chỉ-đọc (Get / List / Describe) cần rule ở trạng thái ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS; data event (ví dụ S3 GetObject) cần trail ghi chúng trước.
  • One action can produce both row 1 and row 2: StartInstances arrives as an API-call event and as two state-change events (pending, running). Match the one you mean.Một hành động có thể sinh ra cả hàng 1 lẫn hàng 2: StartInstances tới dưới dạng một event API-call và hai event đổi trạng thái (pending, running). Match đúng cái bạn muốn.

2 · Why it isn't uniform2 · Vì sao không đồng nhất

The mess is history, not design. A feature's own "notify" setting points at whatever pipe existed when it shipped. Features from the SNS era got an SNS field; data features from 2013–14 got streams; everything after 2016 just emits to the bus. Old fields were never removed. Sự lộn xộn là do lịch sử, không phải thiết kế. Ô "thông báo" của một tính năng trỏ tới đường ống tồn tại lúc nó ra đời. Tính năng thời SNS có ô SNS; tính năng dữ liệu năm 2013–14 có stream; mọi thứ sau 2016 chỉ việc bắn lên bus. Các ô cũ chưa bao giờ bị gỡ.

Timeline: SNS 2010, Kinesis 2013, Lambda with S3 notifications and DynamoDB Streams 2014, CloudWatch Events 2016, EventBridge 2019, S3 to EventBridge 2021, Pipes and Scheduler 2022, alarms invoking Lambda directly 2023 2010 · SNS alarms, RDS, ASG get a "notify topic" field 2014 · Lambda S3 notifications DynamoDB Streams 2019 · EventBridge same bus, renamed + custom · partner buses 2022 · Pipes stream → target + Scheduler 2013 · Kinesis ordered, replayable 2016 · CloudWatch Events first account-wide bus 2021 · S3 → EventBridge opt-in per bucket 2023 · alarm → Lambda no SNS hop needed

Amber = the SNS era, blue = streams, indigo = the bus. When a question names a feature from the amber band (RDS events, ASG notifications, alarm actions), expect an SNS topic in the answer; for anything newer, expect EventBridge.

Vàng = thời SNS, xanh nhạt = stream, xanh đậm = bus. Khi đề nhắc tới một tính năng thuộc dải vàng (RDS event, ASG notification, alarm action), đáp án thường có SNS topic; với thứ mới hơn, đáp án thường là EventBridge.

3 · When you get to choose the pipe3 · Khi được tự chọn đường ống

Four transports, four shapes. The question to ask is who moves the message and what happens to it after delivery: SNS pushes and forgets, SQS holds until one worker deletes, EventBridge pushes to whoever's rule matches, Kinesis keeps everything so each reader keeps its own place. Bốn kiểu vận chuyển, bốn hình dạng. Câu hỏi cần đặt ra là ai di chuyển message và nó ra sao sau khi giao: SNS đẩy rồi quên, SQS giữ cho tới khi một worker xoá, EventBridge đẩy tới rule nào khớp, Kinesis giữ lại tất cả để mỗi reader tự nhớ mình đọc tới đâu.

Four transports side by side: SNS pushes a copy to every subscriber; SQS holds messages until a consumer polls and deletes them; EventBridge matches rules on content and pushes to each matched target; Kinesis keeps an ordered log per shard that several consumers read at their own position SNS · push fan-out pub topic email SQS Lambda push · stores nothing every sub gets a copy filter policy per sub the one that reaches humans (email · SMS) SQS · buffer send worker polls waits here until deleted pull · kept ≤ 14 days 1 message → 1 worker retry = visibility timeout, then DLQ absorbs spikes EventBridge · router evt bus rule rule ✕ no match Lambda acct B pattern on any JSON field push · match on content ≤ 5 targets per rule archive + replay cross-account · cron every aws.* event here Kinesis · ordered log put A B shards · A and B read independently pull · order per key kept 24 h → 365 days each reader has its own position re-read = replay

Push (SNS, EventBridge) vs pull (SQS, Kinesis) is the first split. Then: does the message survive delivery? SQS keeps it until one worker deletes it; Kinesis keeps it for everyone until retention expires.

Đẩy (SNS, EventBridge) hay kéo (SQS, Kinesis) là lằn ranh đầu tiên. Sau đó: message có còn sau khi giao không? SQS giữ tới khi một worker xoá; Kinesis giữ cho tất cả mọi người tới khi hết retention.

SNS SQS EventBridge Kinesis Data Streams
Kept after delivery?Còn giữ sau khi giao? NoKhông Until a worker deletes it (≤ 14 days)Tới khi worker xoá (≤ 14 ngày) No — unless you turn on an archiveKhông — trừ khi bật archive Yes, for everyone (24 h – 365 days)Có, cho tất cả (24 h – 365 ngày)
Same event to many consumersMột event tới nhiều consumer Yes — that's the pointCó — đó là mục đích No — one worker takes itKhông — một worker nhận Yes — one per matching rule targetCó — mỗi target của rule khớp Yes — each reads independentlyCó — mỗi consumer đọc riêng
OrderingThứ tự FIFO topic onlyChỉ FIFO topic FIFO queue, per message groupFIFO queue, theo message group Not guaranteedKhông đảm bảo Per partition key (shard)Theo partition key (shard)
FilteringLọc Filter policy per subscriptionFilter policy trên từng subscription None — consumer reads allKhông — consumer đọc hết Rich patterns on any fieldPattern mạnh trên mọi field None in the stream (filter in Lambda ESM / Pipes)Không có trong stream (lọc ở Lambda ESM / Pipes)
Who usually sends to itAi thường gửi vào Older AWS "notify" settings; your appCác ô "notify" đời cũ của AWS; app của bạn S3 notifications, SNS, EventBridge, your appS3 notification, SNS, EventBridge, app của bạn Every AWS service (state + CloudTrail), SaaS partnersMọi service AWS (state + CloudTrail), SaaS partner Your producers, DynamoDB, DMS, Aurora DAS, LogsProducer của bạn, DynamoDB, DMS, Aurora DAS, Logs
Reach for it whenDùng khi A human or many systems must hear it nowNgười hoặc nhiều hệ thống cần nghe ngay Work must not be lost and the consumer is slower than the producerViệc không được mất và consumer chậm hơn producer Different events need different handlers, maybe in other accountsEvent khác nhau cần handler khác nhau, có thể ở account khác High volume, order matters, several consumers or replayLưu lượng lớn, cần thứ tự, nhiều consumer hoặc cần replay

4 · The map — service by service4 · Bản đồ — từng service

Two columns matter. Its own hook = the setting on that service (often older, often SNS, or a data stream). On the bus? = whether the service puts state changes on EventBridge by itself. "API calls only" means the only way onto the bus is CloudTrail — true for every service, so it's the fallback, not a feature. Filter by category or by pipe. Có hai cột quan trọng. Móc riêng = ô cài đặt trên chính service đó (thường đời cũ, thường SNS, hoặc data stream). Lên bus? = service có tự đẩy thay đổi trạng thái lên EventBridge không. "Chỉ API call" nghĩa là đường duy nhất lên bus là qua CloudTrail — đúng với mọi service, nên đó là đường lui, không phải tính năng. Lọc theo nhóm hoặc theo đường ống.

GroupNhóm
PipeĐường ống
Service What changesCái gì thay đổi Its own hookMóc riêng On the bus?Lên bus?
EC2 Instance state · Spot 2-min interruption · rebalance recommendation · EBS snapshot doneTrạng thái instance · Spot báo trước 2 phút · rebalance recommendation · EBS snapshot xong — Spot notice also in instance metadataSpot notice cũng có trong instance metadata native aws.ec2
Auto Scaling Instance launched / terminated / failed · lifecycle hook pausedInstance launch / terminate / lỗi · lifecycle hook đang chờ SNS ASG notificationsASG notification
SNSSQS lifecycle hook targettarget của lifecycle hook
native aws.autoscaling
ECS Task / container instance / service deployment stateTrạng thái task / container instance / service deployment — native aws.ecs
Batch Job SUBMITTED → RUNNABLE → … → SUCCEEDED / FAILEDJob SUBMITTED → RUNNABLE → … → SUCCEEDED / FAILED — native aws.batch
Lambda Result of an async invocation — success or failureKết quả một lần gọi async — thành công hay thất bại SQSSNSLambdaEB destinations; + S3 on failure · DLQ = SQS / SNSdestinations; + S3 khi lỗi · DLQ = SQS / SNS only if you pick EventBridge as the destinationchỉ khi chọn EventBridge làm destination
S3 Object created / removed / restored / replicated / lifecycle / taggedObject được tạo / xoá / restore / replicate / lifecycle / gắn tag SNSSQSLambda Event Notifications · standard only, no FIFOEvent Notifications · chỉ standard, không FIFO opt-in per bucket, then all eventstheo bucket, rồi gửi tất cả event
AWS Backup Backup / copy / restore job completed or failedJob backup / copy / restore xong hoặc lỗi SNS vault notificationsvault notification native aws.backup
DynamoDB Item insert / modify / remove (TTL deletes too)Item insert / modify / remove (cả TTL xoá) DDB StreamsKDS → Lambda ESM polls the stream→ Lambda ESM poll stream no item changes never hit the bus — use Pipes from the streamthay đổi item không lên bus — dùng Pipes từ stream
RDS · Aurora instance Failover · reboot · low storage · maintenance · snapshotFailover · reboot · sắp hết dung lượng · bảo trì · snapshot SNS RDS event subscriptionRDS event subscription native aws.rds
RDS · Aurora rows Row insert / update / deleteRow insert / update / delete none build it: DMS CDC → tự dựng: DMS CDC → KDS · Aurora SQL → Lambda no
Aurora activity Who ran which SQL (audit)Ai chạy câu SQL nào (audit) KDS Database Activity Streams no
CloudWatch alarm OK ↔ ALARM ↔ INSUFFICIENT_DATAOK ↔ ALARM ↔ INSUFFICIENT_DATA SNSLambda + EC2 stop / reboot / recover · ASG scale · SSM OpsItem+ EC2 stop / reboot / recover · ASG scale · SSM OpsItem native Alarm State Change
CloudWatch Logs A log line arrives (matching a filter pattern)Một dòng log tới (khớp filter pattern) KDSFirehoseLambda subscription filtersubscription filter
metric → alarm metric filtermetric filter
no log lines are datadòng log là dữ liệu
CloudWatch metrics Every datapoint, continuouslyMọi datapoint, liên tục Firehose metric streams no only the alarm's flip ischỉ việc alarm đổi trạng thái mới lên
CloudTrail Every API call · console sign-inMọi API call · đăng nhập console S3CW Logs trail destinationsđích của trail native AWS API Call via CloudTrail
AWS Config Resource configuration changed · rule compliance changedCấu hình tài nguyên đổi · compliance của rule đổi SNS configuration streamconfiguration stream native aws.config
AWS Health AWS issue · scheduled change on your resourcesSự cố phía AWS · scheduled change trên tài nguyên của bạn — native aws.health
Trusted Advisor Check status changedTrạng thái check đổi — weekly emailemail hằng tuần native us-east-1
Route 53 health check · ELB Endpoint / target becomes unhealthyEndpoint / target thành unhealthy metric → alarm a number, not an eventlà con số, không phải event no alarm it, then alarm → SNS / EBđặt alarm, rồi alarm → SNS / EB
GuardDuty · Inspector New / updated finding · scan completeFinding mới / cập nhật · scan xong — also into Security Hubcũng đổ vào Security Hub native aws.guardduty
Macie · Security Hub Sensitive-data finding · aggregated findings importedFinding dữ liệu nhạy cảm · finding tổng hợp được import — native aws.securityhub
KMS · ACM Key rotated / deleted / imported material expired · certificate approaching expiryKey được xoay / bị xoá / key material import hết hạn · certificate sắp hết hạn — native aws.kms aws.acm
Secrets Manager Rotation due · rotation succeeded / failedTới hạn rotation · rotation thành công / lỗi Lambda the rotation function is the hookchính rotation function là cái móc API calls only
IAM · Organizations User / role / policy created · account created · SCP attachedTạo user / role / policy · tạo account · gắn SCP — API calls only us-east-1
CloudFormation Stack / resource / StackSet / drift status changedTrạng thái stack / resource / StackSet / drift đổi SNS NotificationARNs native aws.cloudformation
CodePipeline · CodeBuild · CodeDeploy Pipeline / stage / build / deployment stateTrạng thái pipeline / stage / build / deployment SNS notification rules · CodeDeploy triggersnotification rule · CodeDeploy trigger native
Systems Manager Run Command / Automation status · Parameter Store changeTrạng thái Run Command / Automation · Parameter Store đổi SNS Run Command notificationsRun Command notification native aws.ssm
Budgets Actual / forecast crosses a thresholdChi phí thực / dự báo vượt ngưỡng SNS + email · Budget Actions (IAM / SCP / stop EC2·RDS)+ email · Budget Actions (IAM / SCP / stop EC2·RDS) the alert itself leaves by SNS / emailbản thân cảnh báo đi ra qua SNS / email
Step Functions Execution RUNNING / SUCCEEDED / FAILED / TIMED_OUT / ABORTEDExecution RUNNING / SUCCEEDED / FAILED / TIMED_OUT / ABORTED — native aws.states
Glue · EMR Job / crawler / cluster / step stateTrạng thái job / crawler / cluster / step — native aws.glue aws.emr
SQS · Kinesis · MSK A message / record arrivesMột message / record tới Lambda ESM polls itESM poll nó · Firehose (KDS) no messages aren't bus events — Pipes bridges themmessage không phải event của bus — Pipes làm cầu nối
SES Send · delivery · bounce · complaint · open · clickGửi · giao · bounce · complaint · mở · click SNSFirehoseCloudWatchEB configuration set event destinationsevent destination của configuration set if you pick EventBridge as a destinationnếu chọn EventBridge làm destination
IoT Core Device publishes an MQTT messageThiết bị publish một MQTT message LambdaSNSSQSKDSFirehose Rules Engine SQL · + DynamoDB, S3, TimestreamRules Engine SQL · + DynamoDB, S3, Timestream no device messages are datamessage thiết bị là dữ liệu
Cognito Sign-up · pre / post authentication · pre token generationSign-up · trước / sau xác thực · trước khi sinh token Lambda triggers — synchronous, can block the logintrigger — đồng bộ, có thể chặn đăng nhập no (API calls via CloudTrail only)(chỉ API call qua CloudTrail)
  • Read the "no" rows as the exam's favourite traps: DynamoDB items, RDS rows, log lines, metric datapoints, queue messages — none of them are EventBridge events. Each has a stream or an alarm in between.Đọc các hàng "no" như những cái bẫy ưa thích của đề: item DynamoDB, row RDS, dòng log, datapoint metric, message trong queue — không cái nào là event của EventBridge. Mỗi cái đều có một stream hoặc một alarm đứng giữa.
  • Rows with both SNS and native (RDS, Config, CloudFormation, Backup, ASG): both answers work. Prefer EventBridge when the answer needs filtering, several target types, or another account; prefer the SNS setting when it just needs a human told.Hàng có cả SNS và native (RDS, Config, CloudFormation, Backup, ASG): cả hai đáp án đều chạy. Chọn EventBridge khi cần lọc, nhiều loại target, hay account khác; chọn ô SNS khi chỉ cần báo cho người.

5 · Same service, different change, different pipe5 · Cùng service, khác thay đổi, khác đường ống

This is where the confusion actually lives. The four services the exam leans on most each split three or four ways depending on what about them changed. Đây mới là chỗ thật sự gây rối. Bốn service mà đề hay hỏi nhất đều tách ra ba bốn ngả tuỳ vào cái gì của nó thay đổi.

S3

S3: object changes go either to classic Event Notifications (SNS, SQS, Lambda) or, if enabled, all to EventBridge; bucket configuration API calls go through CloudTrail management events; object-level reads and writes go through CloudTrail data events THE CHANGE GOES INTO WHO PICKS IT UP an OBJECT changed created · removed · restored replicated · lifecycle tagged · ACL changed Event Notification config pick event types + prefix SNS · SQS · Lambda standard only — no FIFO overlapping prefixes can't split EventBridge: ON (bucket) every event, no choosing rules: key · size · metadata → SQS FIFO · Step Functions archive · replay · other accounts the BUCKET config PutBucketPolicy · DeleteBucket CloudTrail management needs a logging trail EventBridge rule AWS API Call via CloudTrail WHO read / wrote it GetObject · PutObject caller CloudTrail data events opt-in · billed per event trail → S3 / CloudWatch Logs and EventBridge, if you rule on it

The top box splits two ways and you choose per bucket. Classic notifications are cheap and direct but limited to three destination types and can't send the same event type + overlapping prefix to two places — fan out through one SNS topic, or turn on EventBridge and let rules split it.

Hộp trên cùng tách hai ngả và bạn chọn theo bucket. Notification kiểu cũ rẻ và trực tiếp nhưng chỉ có ba loại đích và không gửi cùng event type + prefix chồng nhau tới hai nơi — fan out qua một SNS topic, hoặc bật EventBridge để rule tách giùm.

DynamoDB

DynamoDB: item changes go to DynamoDB Streams (24 hours, exactly once, in order, read by Lambda) or to Kinesis Data Streams for DynamoDB (longer retention, more consumers, possible duplicates); table API calls go through CloudTrail; throttling is a metric THE CHANGE GOES INTO WHO PICKS IT UP an ITEM changed INSERT · MODIFY · REMOVE TTL expiry shows up too (principal: dynamodb service) DynamoDB Streams 24 h · exactly once · in order Lambda ESM · KCL adapter ≤ 2 readers per shard Pipes → EventBridge if needed Kinesis Data Streams ≤ 365 days · dupes possible Firehose → S3 · Flink many consumers, enhanced fan-out consumer fixes order + dupes the TABLE changed CreateTable · UpdateTable CloudTrail management same as every service EventBridge rule AWS API Call via CloudTrail it's THROTTLING ThrottledRequests · capacity CloudWatch metric a number, not an event alarm → SNS / Lambda alarm flip → EventBridge

Two streams for the same item change. DynamoDB Streams when one Lambda needs every change exactly once and in order. Kinesis Data Streams for DynamoDB when you need longer retention, many consumers, or Firehose into a data lake — and accept that order and de-duplication become the consumer's job.

Hai stream cho cùng một thay đổi item. DynamoDB Streams khi một Lambda cần mọi thay đổi đúng một lần và đúng thứ tự. Kinesis Data Streams for DynamoDB khi cần giữ lâu hơn, nhiều consumer, hoặc Firehose vào data lake — và chấp nhận việc sắp thứ tự và loại trùng là việc của consumer.

RDS · Aurora

RDS and Aurora: instance events go to an RDS event subscription SNS topic and to EventBridge; row changes have no built-in event and need DMS change data capture into Kinesis or Aurora calling Lambda from SQL; SQL activity auditing goes through Database Activity Streams into Kinesis; resource numbers are CloudWatch metrics THE CHANGE GOES INTO WHO PICKS IT UP the INSTANCE failover · reboot low storage · maintenance snapshot finished RDS event subscription pick categories + sources SNS topic → email · SQS · Lambda EventBridge (aws.rds) same events, no setup rule → Lambda · SSM · SFN filter, other accounts a ROW changed INSERT · UPDATE · DELETE ✕ no built-in event nothing like DDB Streams build it: DMS CDC → Kinesis or Aurora SQL calls Lambda (lambda_async · aws_lambda) WHO ran which SQL audit · compliance Database Activity Streams pushes into Kinesis Firehose → S3 · SIEM kept out of the DBAs' reach a NUMBER moved CPU · FreeStorage · lag CloudWatch metric not an event until alarmed alarm → SNS / Lambda alarm flip → EventBridge

The red row is the trap. "Trigger a Lambda whenever a row is inserted into RDS" has no switch to flip — the answers are DMS CDC into Kinesis, or (Aurora only) a trigger / stored procedure that calls Lambda itself. Activity Streams look similar but carry who ran what, for auditors, not the changed data for apps.

Hàng đỏ là cái bẫy. "Kích hoạt Lambda mỗi khi có row được insert vào RDS" không có công tắc nào để bật — đáp án là DMS CDC vào Kinesis, hoặc (chỉ Aurora) trigger / stored procedure tự gọi Lambda. Activity Streams trông giống nhưng chở ai chạy cái gì cho auditor, không phải dữ liệu thay đổi cho app.

CloudWatch

CloudWatch: an alarm state change runs alarm actions (SNS, Lambda, EC2, Auto Scaling, Systems Manager) and also emits to EventBridge; log lines go through subscription filters to Kinesis, Firehose or Lambda, or through metric filters into a metric; all metric datapoints can be exported through metric streams to Firehose THE CHANGE GOES INTO WHO PICKS IT UP an ALARM flipped OK ↔ ALARM ↔ INSUFFICIENT_DATA fires on change, not per min alarm actions set on the alarm itself SNS · Lambda EC2 stop · reboot · recover ASG scaling · SSM OpsItem EventBridge CloudWatch Alarm State Change any EventBridge target SFN · SSM Automation · acct B a LOG LINE arrived raw, near-real-time subscription filter ≤ 5 per log group Kinesis · Firehose · Lambda OpenSearch via Lambda cross-account: Logs destination a line MATCHED count ERROR, 5xx, "denied" metric filter turns lines into a number metric → alarm then back to the top row EVERY datapoint continuous export metric stream near-real-time, all of them Firehose → S3 · Datadog · Splunk

CloudWatch speaks every dialect at once: alarms are the SNS-era door (and now Lambda directly), the alarm flip is also an EventBridge event, and logs are data that leave by stream. "Real-time log processing" → subscription filter, never EventBridge.

CloudWatch nói mọi thứ tiếng cùng lúc: alarm là cửa thời SNS (và giờ gọi thẳng Lambda), việc alarm đổi trạng thái cũng là một event EventBridge, còn log là dữ liệu đi ra bằng stream. "Xử lý log thời gian thực" → subscription filter, không bao giờ là EventBridge.

6 · Who actually calls the Lambda6 · Ai thật sự gọi Lambda

"Triggers Lambda" hides three different mechanics, and they decide what happens on failure. Push sources hand the event to Lambda and walk away; poll sources are read by Lambda itself; sync callers wait for the answer. "Kích hoạt Lambda" che giấu ba cơ chế khác nhau, và chúng quyết định chuyện gì xảy ra khi lỗi. Nguồn kiểu đẩy giao event cho Lambda rồi đi; nguồn kiểu poll được chính Lambda đọc; caller đồng bộ thì đứng chờ kết quả.

Three ways Lambda is invoked: push asynchronously from S3, SNS, EventBridge, CloudWatch alarms and IoT rules with two retries then a destination or DLQ; poll through an event source mapping from SQS, Kinesis, DynamoDB Streams, MSK and Amazon MQ; synchronous from API Gateway, ALB, Cognito and Lambda@Edge with errors returned to the caller PUSH · async S3 SNS EventBridge CW alarm IoT rule Lambda's queue sender gets 202 function on error: 2 retries (default) → on-failure destination or DLQ on the function sender never sees the error POLL · event source mapping SQS Kinesis DDB Streams MSK · Kafka Amazon MQ ESM poller pulls batches function on error: SQS → message reappears, then the QUEUE's DLQ stream → shard blocks bisect · on-failure dest the source keeps the data SYNC · caller waits API Gateway ALB Cognito Lambda@Edge function returns response on error: goes straight back to the caller Lambda never retries caller decides what to do

Where you put the DLQ follows from this. Push → on the function (or an on-failure destination). Poll from SQS → on the queue (redrive policy), not the function. Poll from a stream → on-failure destination on the mapping, because a bad record otherwise blocks its shard.

Chỗ đặt DLQ suy ra từ đây. Đẩy → đặt trên function (hoặc on-failure destination). Poll từ SQS → đặt trên queue (redrive policy), không phải function. Poll từ stream → on-failure destination trên mapping, vì nếu không một record hỏng sẽ chặn cả shard.

7 · Bridges — from the pipe you have to the pipe you want7 · Cầu nối — từ đường ống đang có sang đường ống cần

The native pipe is fixed by the service, but almost everything can be chained. Most "which architecture" answers are one of these five bridges. Đường ống gốc do service quyết định, nhưng gần như mọi thứ đều nối tiếp được. Phần lớn đáp án "kiến trúc nào" là một trong năm cây cầu này.

Five common bridges: S3 notification to SNS to several SQS queues; EventBridge to SNS for humans; EventBridge to Firehose or Kinesis for a data lake; EventBridge Pipes from a queue or stream through filter and enrichment to a target; CloudWatch alarm directly to Lambda instead of through SNS S3 notification SNS topic SQS × N EventBridge rule SNS topic email · SMS · chat EventBridge rule Firehose / Kinesis S3 → Athena SQS · KinesisDDB Streams · MSK EventBridge Pipesfilter → enrich one targetbus · SFN · API … CloudWatch alarm SNS hop — optional now Lambda one object event,several queues bus event, told toa human events kept as datafor later queries point-to-point, noglue Lambda needed remediate straightfrom the alarm

Pipes vs a rule: a rule listens to a bus and fans out to up to five targets; a Pipe drains one queue or stream (things the bus can't hear) into exactly one target, with optional filter and enrichment in between.

Pipes khác rule: rule nghe một bus và fan out tới tối đa năm target; Pipe rút từ một queue hay stream (những thứ bus không nghe được) vào đúng một target, có thể lọc và làm giàu dữ liệu ở giữa.

Exam reflexesPhản xạ khi thi

  • "Notify when an EC2 instance stops / terminates" → EventBridge rule on EC2 Instance State-change Notification → SNS."Báo khi EC2 instance dừng / terminate" → EventBridge rule trên EC2 Instance State-change Notification → SNS.
  • "Alert when someone disables CloudTrail / opens port 22 / creates an IAM user" → EventBridge rule on AWS API Call via CloudTrail. For IAM, the rule lives in us-east-1."Cảnh báo khi ai đó tắt CloudTrail / mở port 22 / tạo IAM user" → EventBridge rule trên AWS API Call via CloudTrail. Với IAM, rule phải nằm ở us-east-1.
  • "Process every new S3 object" → S3 Event Notification → Lambda or SQS. "Several consumers for the same prefix" → notification → SNS → SQS ×N, or EventBridge. "Into a FIFO queue" → must be EventBridge."Xử lý mỗi object S3 mới" → S3 Event Notification → Lambda hoặc SQS. "Nhiều consumer cho cùng prefix" → notification → SNS → SQS ×N, hoặc EventBridge. "Vào FIFO queue" → bắt buộc EventBridge.
  • "React to every DynamoDB change" → DynamoDB Streams + Lambda. "Keep changes longer than 24 h / many consumers / into a data lake" → Kinesis Data Streams for DynamoDB."Phản ứng với mọi thay đổi DynamoDB" → DynamoDB Streams + Lambda. "Giữ thay đổi quá 24 h / nhiều consumer / vào data lake" → Kinesis Data Streams for DynamoDB.
  • "Stream changes from RDS / on-prem Oracle in near-real-time" → DMS with CDC → Kinesis. There is no RDS equivalent of DynamoDB Streams."Stream thay đổi từ RDS / Oracle on-prem gần thời gian thực" → DMS với CDC → Kinesis. RDS không có thứ tương đương DynamoDB Streams.
  • "Be told about RDS failover / low storage" → RDS event subscription → SNS (or EventBridge aws.rds). Low storage threshold you choose → CloudWatch alarm on FreeStorageSpace."Được báo khi RDS failover / sắp hết dung lượng" → RDS event subscription → SNS (hoặc EventBridge aws.rds). Ngưỡng dung lượng do bạn tự chọn → CloudWatch alarm trên FreeStorageSpace.
  • "Real-time log analysis / ship logs to another account" → subscription filter → Kinesis / Firehose (cross-account via a Logs destination). "Count errors and alert" → metric filter → alarm."Phân tích log thời gian thực / chuyển log sang account khác" → subscription filter → Kinesis / Firehose (cross-account qua Logs destination). "Đếm lỗi và cảnh báo" → metric filter → alarm.
  • "Auto-remediate a GuardDuty / Security Hub / Config finding" → EventBridge → Lambda or SSM Automation. Config also has its own remediation action (SSM document) on the rule."Tự khắc phục finding của GuardDuty / Security Hub / Config" → EventBridge → Lambda hoặc SSM Automation. Config còn có remediation action riêng (SSM document) gắn trên rule.
  • "Drain / back up an instance before ASG terminates it" → lifecycle hook → EventBridge → Lambda / Run Command → CompleteLifecycleAction."Drain / backup instance trước khi ASG terminate" → lifecycle hook → EventBridge → Lambda / Run Command → CompleteLifecycleAction.
  • "Certificate expiring" → ACM's own EventBridge event (or Config rule acm-certificate-expiration-check). "Spot about to be reclaimed" → 2-minute warning on EventBridge."Certificate sắp hết hạn" → event EventBridge riêng của ACM (hoặc Config rule acm-certificate-expiration-check). "Spot sắp bị thu hồi" → cảnh báo 2 phút trên EventBridge.
  • Distractor smell: an answer that puts DynamoDB items, RDS rows, log lines or metric datapoints directly on EventBridge is wrong — there's always a stream or alarm in between.Mùi đáp án nhiễu: phương án đưa item DynamoDB, row RDS, dòng log hay datapoint metric thẳng lên EventBridge là sai — luôn có một stream hoặc alarm đứng giữa.
RelatedLiên quan The bus itself: EventBridge. The transports: SNS, SQS, Kinesis Data Streams. Pipelines built on top: Streaming architectures. The sibling page for numbers: Where metrics come from. Bản thân bus: EventBridge. Các kiểu vận chuyển: SNS, SQS, Kinesis Data Streams. Pipeline dựng phía trên: Streaming architectures. Trang anh em cho số liệu: Where metrics come from.