Amazon MSK

Fully managed Apache Kafka. Same API as vanilla Kafka; AWS runs the brokers (and, on classic MSK, the ZooKeeper / KRaft metadata layer) inside your VPC across multiple AZs. Pick MSK when your teams already speak Kafka, or when Kinesis's 1 MB record cap / 24-hour default retention doesn't fit.

Apache Kafka fully managed. Vẫn là API Kafka thường; AWS chạy broker (và, ở MSK classic, tầng metadata ZooKeeper / KRaft) trong VPC của bạn, nhiều AZ. Chọn MSK khi team đã quen Kafka, hoặc khi giới hạn record 1 MB / retention mặc định 24h của Kinesis không đủ.

Reach for itNên dùng

  • Team already has Kafka producers/consumers or Kafka Connect connectorsTeam đã có producer/consumer Kafka hoặc Kafka Connect connector
  • Records > 1 MB (up to 10 MB with config change)Record > 1 MB (tới 10 MB nếu cấu hình)
  • Need retention beyond 365 days or tiered storage into S3Cần retention hơn 365 ngày hoặc tiered storage vào S3
  • Existing Kafka ecosystem tools (Schema Registry, Streams API, ksqlDB clients)Đã có hệ sinh thái Kafka (Schema Registry, Streams API, ksqlDB client)

Not the right toolKhông hợp

  • No Kafka expertise + want "serverless streaming" → Kinesis Data Streams on-demandKhông rành Kafka + muốn "streaming serverless" → Kinesis Data Streams on-demand
  • Just deliver to S3/Redshift/OpenSearch → FirehoseChỉ đổ vào S3/Redshift/OpenSearch → Firehose
  • Fanning out AWS events (S3, DynamoDB, CloudWatch) → EventBridge / SNSFan-out event AWS (S3, DynamoDB, CloudWatch) → EventBridge / SNS

Provisioned vs ServerlessProvisioned vs Serverless

Provisioned Serverless
CapacityCapacity You pick broker instance type (kafka.m7g.large+), broker count (min 3, up to 15 per AZ), EBS sizeChọn instance broker (kafka.m7g.large+), số broker (tối thiểu 3, tối đa 15/AZ), size EBS Fully managed — set a throughput ceiling per topicManaged hoàn toàn — chỉ đặt trần throughput mỗi topic
Multi-AZMulti-AZ 1, 2, or 3 AZs1, 2, hoặc 3 AZ Always multi-AZLuôn multi-AZ
RetentionRetention Bounded by EBS you provision; tiered storage → S3 for older segmentsGiới hạn theo EBS provision; tiered storage → S3 cho segment cũ Up to 24 h hot on brokers (older data offloaded automatically)Tối đa 24 h hot trên broker (data cũ tự offload)
AuthAuth mTLS, SASL/SCRAM, IAMmTLS, SASL/SCRAM, IAM IAM onlyChỉ IAM
BillingTính phí Broker-hour + EBS GB-monthBroker-giờ + EBS GB-tháng Cluster-hour + throughput (partition-hour) + storage GB-monthCluster-giờ + throughput (partition-giờ) + storage GB-tháng

Kinesis Data Streams vs MSKKinesis Data Streams vs MSK

KDS MSK
Record sizeRecord size 1 MB hard cap 1 MB default, up to 10 MB via message.max.bytes
ConceptKhái niệm Streams with shards Topics with partitions
ScaleScale Split & merge shards (or on-demand)Split & merge shard (hoặc on-demand) Add partitions only (Kafka rule) — cannot remove; add brokers + rebalance manuallyChỉ thêm partition (luật Kafka) — không bỏ; thêm broker + rebalance thủ công
RetentionRetention 1–365 days Unbounded — as long as you have disk / tiered storageKhông giới hạn — miễn có disk / tiered storage
Encryption in-flightMã hoá in-flight TLS only TLS or PLAINTEXT (PLAINTEXT for legacy Kafka clients)TLS hoặc PLAINTEXT (PLAINTEXT cho client Kafka cũ)
NetworkingNetwork Regional endpoint (VPC endpoint optional)Endpoint region (VPC endpoint tuỳ chọn) Brokers run in your VPC — private by designBroker chạy trong VPC của bạn — private mặc định

Consumers & connectorsConsumer & connector

Anything that speaks Kafka can consume from MSK. AWS-native paths: Lambda ESM, Managed Flink, Glue Streaming ETL. For sink connectors (S3/Redshift/etc.) use MSK Connect (managed Kafka Connect) or route via Firehose. Bất cứ thứ gì nói Kafka đều consume được MSK. Đường native AWS: Lambda ESM, Managed Flink, Glue Streaming ETL. Cho sink connector (S3/Redshift/…) dùng MSK Connect (Kafka Connect managed) hoặc đi qua Firehose.

  • Lambda ESM for MSK: reads by topic, scales by partition count (one poller per partition). Set batch size and max batching window.Lambda ESM cho MSK: đọc theo topic, scale theo số partition (1 poller/partition). Đặt batch size và max batching window.
  • MSK Connect hosts Kafka Connect sink/source connectors — S3 sink, Debezium (CDC from RDS), JDBC, etc. Pay per worker-hour.MSK Connect host connector sink/source Kafka Connect — S3 sink, Debezium (CDC từ RDS), JDBC… Tính phí theo worker-giờ.
  • MSK → Firehose (native, GA 2023) is the easiest "archive Kafka topic to S3" path — no MSK Connect worker to manage.MSK → Firehose (native, GA 2023) là đường dễ nhất để "archive topic Kafka vào S3" — không phải quản MSK Connect worker.
  • Managed Flink reads MSK natively (both provisioned and serverless).Managed Flink đọc MSK native (cả provisioned lẫn serverless).

Operational notesGhi chú vận hành

  • ZooKeeper → KRaft. New MSK clusters default to KRaft mode (no ZooKeeper). Old clusters can migrate. KRaft = fewer moving parts, faster metadata ops.ZooKeeper → KRaft. Cluster MSK mới mặc định chạy KRaft (không ZooKeeper). Cluster cũ có thể migrate. KRaft = ít component hơn, thao tác metadata nhanh hơn.
  • Broker log ingestion → CloudWatch Logs / S3 / Firehose. Metrics via Enhanced Monitoring (partition-level).Ingest log broker → CloudWatch Logs / S3 / Firehose. Metric qua Enhanced Monitoring (mức partition).
  • MSK Replicator = managed MirrorMaker 2 for cross-region or cross-cluster DR/migration.MSK Replicator = MirrorMaker 2 managed cho DR/migration cross-region hoặc cross-cluster.