Amazon Route 53은 AWS의 고가용성 DNS 서비스로, 도메인 등록, DNS 라우팅, 헬스체크를 통합 제공한다. 전 세계 엣지 로케이션을 통해 낮은 지연시간을 보장한다.
Route 53 라우팅 정책
| 정책 | 설명 | 사용 사례 |
|---|
| Simple | 단순 DNS 응답 | 단일 리소스 |
| Weighted | 가중치 기반 트래픽 분산 | 카나리 배포 |
| Latency | 지연시간 기반 | 글로벌 서비스 |
| Failover | Active-Passive 장애 조치 | DR 구성 |
| Geolocation | 사용자 위치 기반 | 지역별 콘텐츠 |
| Geoproximity | 지리적 거리 + 편향 | 트래픽 조정 |
| Multivalue | 다수 IP 반환 (헬스체크 포함) | 간단한 LB |
헬스체크 설정
bash
# 헬스체크 생성
aws route53 create-health-check --caller-reference $(date +%s) --health-check-config '{
"Type": "HTTPS",
"FullyQualifiedDomainName": "api.example.com",
"ResourcePath": "/health",
"RequestInterval": 30,
"FailureThreshold": 3,
"EnableSNI": true
}'
hcl
# Primary 레코드
resource "aws_route53_record" "primary" {
zone_id = aws_route53_zone.main.zone_id
name = "api.example.com"
type = "A"
failover_routing_policy {
type = "PRIMARY"
}
set_identifier = "primary"
health_check_id = aws_route53_health_check.primary.id
alias {
name = aws_lb.primary.dns_name
zone_id = aws_lb.primary.zone_id
evaluate_target_health = true
}
}
# Secondary (DR) 레코드
resource "aws_route53_record" "secondary" {
zone_id = aws_route53_zone.main.zone_id
name = "api.example.com"
type = "A"
failover_routing_policy {
type = "SECONDARY"
}
set_identifier = "secondary"
alias {
name = aws_lb.secondary.dns_name
zone_id = aws_lb.secondary.zone_id
evaluate_target_health = true
}
}
Weighted 라우팅 (카나리 배포)
hcl
resource "aws_route53_record" "stable" {
name = "api.example.com"
type = "A"
weighted_routing_policy { weight = 90 }
set_identifier = "stable"
# ALB alias...
}
resource "aws_route53_record" "canary" {
name = "api.example.com"
type = "A"
weighted_routing_policy { weight = 10 }
set_identifier = "canary"
# Canary ALB alias...
}
Private Hosted Zone (VPC 내부)
bash
# VPC 내부 전용 DNS 생성
aws route53 create-hosted-zone --name internal.example.com --caller-reference $(date +%s) --hosted-zone-config '{"PrivateZone":true}' --vpc VPCRegion=ap-northeast-2,VPCId=vpc-12345