brandonwie.dev
EN / KR
On this page
aws awssecuritywafwork

AWS WAF 구현

Allowlist 방식의 Web Application Firewall 설정 가이드.

Updated March 22, 2026 1 min read

아키텍처

환경타입기본 동작비용
ProductionRegional WAFBLOCK~$23/월
Dev/LocalRegional WAF(공유)BLOCK~$7/월

Production WAF 규칙

Allowlist 규칙(Priority 1-3)

허용되는 엔드포인트:

인증

  • /auth, /v1/auth
  • /google(OAuth)

Core API

  • /blocks, /calendars, /spaces
  • /users, /contacts

통합

  • /v1/integrations
  • /subscriptions
  • /webhooks(결제)

유틸리티

  • /health(ALB)
  • /internals

AWS Managed Rules(Priority 10-11)

  • Core Rule Set: OWASP Top 10(~700개 이상 규칙)
  • Known Bad Inputs: 악성 페이로드(~200개 이상 패턴)

Rate Limiting

  • Production: IP당 5분 내 500 요청
  • Dev: IP당 5분 내 1000 요청

모니터링

# 실시간 로그
aws logs tail aws-waf-logs-prod --follow

# 차단된 요청
aws logs filter-log-events 
  --log-group-name aws-waf-logs-prod 
  --filter-pattern '"action":"BLOCK"'

# 활동 요약(최근 1시간)
aws logs filter-log-events 
  --log-group-name aws-waf-logs-prod 
  --start-time $(echo $(($(date +%s) - 3600))000) 
  --query 'events[*].message' 
  --output text | jq -r '.action' | sort | uniq -c

유지보수

차단 IP 추가

# waf.tf에서
addresses = [
  "192.0.2.1/32",    # 악성 IP
  "203.0.113.0/24",  # 악성 범위
]

새 라우트 추가

waf.tf의 allowlist 규칙에 추가한 후 terraform apply를 실행하세요.

Rollback

# WAF 비활성화(설정은 유지)
terraform destroy -target=aws_wafv2_web_acl_association.alb_waf

# 완전 제거
terraform destroy -target=module.waf

Dev vs Production

항목ProductionDev
규칙102
Managed rules있음없음
로깅CloudWatch없음
/api(Swagger)차단허용

Comments

enko