본문으로 건너뛰기
김신건의 로그

[AWS] SNS: pub-sub fan-out

· 수정 · 📖 약 1분 · 278자/단어 #aws #sns #pubsub #cloud #messaging
SNS, Simple Notification Service, SNS topic, fan-out, SMS notification, Mobile push

정의

SNS (Simple Notification Service) = pub-sub fan-out. 한 message → 여러 subscriber 에 동시 배포.

구조

flowchart LR
    P[Publisher] --> Topic[SNS Topic]
    Topic --> S1[SQS Queue 1]
    Topic --> S2[SQS Queue 2]
    Topic --> S3[Lambda]
    Topic --> S4[Email]
    Topic --> S5[SMS / Mobile Push]
    Topic --> S6[HTTP/HTTPS endpoint]

Subscriber 종류

종류사용
SQS큐 fan-out
Lambda비동기 처리
Email알림
SMS알림 (전세계)
Mobile PushAPNS, FCM
HTTP/HTTPSwebhook
Kinesis Data Firehose데이터 흐름

Standard vs FIFO Topic

StandardFIFO
순서best-effortstrict (group)
중복가능5분 dedup
처리량무한300/s
Subscriber모든 종류SQS FIFO 만

Message Filtering

"FilterPolicy": {
  "event_type": ["order.created", "order.paid"],
  "region": ["us-east-1"]
}

Subscriber 마다 받을 메시지 필터. 한 topic 에 다양한 event 보내고 각 subscriber 가 관심사만.

SNS + SQS Fan-out 패턴

flowchart LR
    Order[Order Service] -->|publish OrderCreated| Topic
    Topic --> Q1[Queue: shipping]
    Topic --> Q2[Queue: analytics]
    Topic --> Q3[Queue: notification]
    Q1 --> Shipping[Shipping consumer]
    Q2 --> Analytics[Analytics consumer]
    Q3 --> Notify[Notification consumer]

Pub-sub + queue durability. SNS 의 fan-out + SQS 의 영속.

SNS vs EventBridge

SNSEventBridge
Subscriber 수12.5M / topic5 target / rule
Filtering단순 (key=value)advanced (content-based, schema)
Schema Registry없음있음
가격저렴약간 비쌈
사용high fan-out복잡 라우팅 / 외부 SaaS

흔한 함정

WARNING

  1. HTTP subscriber 인증 없음 = aws에서 온 척 한 webhook 위조. SNS signature 검증 필수.
  2. Standard topic의 중복 = subscriber 가 idempotent.
  3. Filter policy 잘못 = silently drop. CloudWatch 메트릭으로 확인.
  4. DLQ 미설정 = subscriber 실패 시 재시도 후 손실. SNS subscription DLQ.

관련 위키

이 글의 용어 (4개)
[AWS] EventBridge: 이벤트 버스, 스케줄러, partner sourcescloud
정의 EventBridge = AWS 의 통합 event bus. 옛 CloudWatch Events 의 후계. AWS service 이벤트 + custom 이벤트 + SaaS …
[AWS] SQS: managed queue, FIFO, DLQcloud
정의 SQS = AWS 의 완전 관리형 메시지 큐. infinite scale, no provisioning, pay-per-request. Standard vs FIFO | |…
[Distributed] Message Broker 비교: Kafka / RabbitMQ / NATS / SQS / Redis Streamsdistributed-systems
결정 트리 6가지 broker 매트릭스 | 항목 | Kafka | RabbitMQ | NATS | SQS | Redis Streams | Google Pub/Sub | |---|…
[Redis] Pub/Sub vs Streams: 휘발 신호 vs 영속 로그database-internals
정의 - Pub/Sub ( / ): 지금 듣고 있는 구독자 에게만 메시지가 전달되는 휘발성 신호. 영속 없음, ACK 없음. fan-out. - Streams ( / / / ):…

💬 댓글

사이트 검색 / 명령어

검색

스크롤 = 확대/축소 · 드래그 = 이동 · 0 = 원래 크기 · ESC = 닫기