Skip to main content

Event-Driven Architecture Patterns

Lambda/SNS/SQS Retry Patterns

  • Lambda + SQS: ใช้ Dead Letter Queue (DLQ) สำหรับ messages ที่ fail
  • SQS FIFO + Lambda สำหรับ ordered processing

Fan Out Pattern

  • SNS → multiple SQS queues (แทนการ PUT ไปหลาย SQS ตรงๆ จาก SDK)
  • Decouples producer จาก consumers
  • เพิ่ม consumer ได้โดยไม่กระทบ producer

S3 Event Notifications

  • Trigger: SNS, SQS, Lambda จาก S3 events
  • EventBridge สำหรับ advanced filtering + ส่งไป 18+ destination services

API Gateway Direct Integrations

  • API Gateway → Kinesis — ส่งข้อมูลตรงๆ ไม่ต้องผ่าน Lambda

Caching Strategy

CloudFront (edge) → API Gateway (regional) → ElastiCache/DAX → Database

IP Blocking Strategy

ลำดับการป้องกัน:

  1. NACL — deny rules ที่ subnet level
  2. ALB Security Group — allow specific IPs
  3. AWS WAF — IP filtering rules
  4. CloudFront — Geo Restriction (ไม่ช่วยเรื่อง specific IP)