LogoSkills

rds-operations

RDS incident response and operational management. Use when investigating RDS performance issues, failovers, snapshots, or parameter changes.

RDS Incident Response and Operations#

ํ•œ๋งˆ๋””๋กœ (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

์ด ์Šคํ‚ฌ์€ ์„œ๋น„์Šค์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ๋˜๋Š” "์ฐฝ๊ณ (๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค)"์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ฒผ์„ ๋•Œ ๋Œ€์‘ํ•˜๋Š” ์‘๊ธ‰ ๋งค๋‰ด์–ผ์ž…๋‹ˆ๋‹ค. ์ฐฝ๊ณ ๊ฐ€ ๊ฝ‰ ์ฐจ๊ฑฐ๋‚˜, ๊ฐ‘์ž๊ธฐ ๋А๋ ค์ง€๊ฑฐ๋‚˜, ์†๋‹˜(์‚ฌ์šฉ์ž)์ด "๊ณต์‚ฌ ์ค‘" ํ™”๋ฉด์„ ๋ณด๊ฒŒ ๋˜๋Š” ์ƒํ™ฉ์„ ๋น ๋ฅด๊ฒŒ ์ง„๋‹จํ•˜๊ณ  ํ•ด๊ฒฐํ•˜๋„๋ก ๋•์Šต๋‹ˆ๋‹ค. ๋งˆ์น˜ ๊ฑด๋ฌผ ๊ด€๋ฆฌ์ธ์ด ์ •์ „์ด๋‚˜ ๋ˆ„์ˆ˜์— ๋Œ€๋น„ํ•œ ๋Œ€์‘ ์ ˆ์ฐจ๋ฅผ ๋ฏธ๋ฆฌ ์ •๋ฆฌํ•ด ๋‘” ๊ฒƒ๊ณผ ๋น„์Šทํ•ฉ๋‹ˆ๋‹ค.

๋ฌด์—‡์„ยท์–ธ์ œ (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

  • ๋ฌด์—‡์„ ํ•ด ์ฃผ๋‚˜์š”
    • ๋ฐ์ดํ„ฐ ์ฐฝ๊ณ (RDS)์˜ ์ƒํƒœ๋ฅผ ์ ๊ฒ€ํ•˜๊ณ , ์ €์žฅ ๊ณต๊ฐ„์ด ๋ถ€์กฑํ•˜๋ฉด ์ฆ‰์‹œ ๋Š˜๋ ค ์ค๋‹ˆ๋‹ค.
    • ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ๋А๋ ค์ง€๊ฑฐ๋‚˜ ๋ฉˆ์ท„์„ ๋•Œ ์›์ธ์„ ์ฐพ์•„๋ƒ…๋‹ˆ๋‹ค.
    • ์Œ“์—ฌ์„œ ๊ณต๊ฐ„์„ ์žก์•„๋จน๋Š” ๋ถˆํ•„์š”ํ•œ ๊ธฐ๋ก์„ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
    • ์‘๊ธ‰ ์กฐ์น˜ ํ›„ ์„ค์ • ๋ฌธ์„œ(์ธํ”„๋ผ ์ฝ”๋“œ)์™€ ์‹ค์ œ ์ƒํƒœ๊ฐ€ ์–ด๊ธ‹๋‚˜์ง€ ์•Š๋„๋ก ๋งž์ถฐ ์ค๋‹ˆ๋‹ค.
  • ์–ธ์ œ ์ž‘๋™ํ•˜๋‚˜์š”
    • ํ™”๋ฉด์— 502/503 ์˜ค๋ฅ˜๋‚˜ "์„œ๋ฒ„ ์ ๊ฒ€ ์ค‘" ์•ˆ๋‚ด๊ฐ€ ๋œฐ ๋•Œ
    • ๋ฐ์ดํ„ฐ ์ฐฝ๊ณ ๊ฐ€ ๊ฑฐ์˜ ๋‹ค ์ฐผ๊ฑฐ๋‚˜ ์ƒํƒœ๊ฐ€ ์ด์ƒํ•  ๋•Œ(storage-full ๋“ฑ)
    • ์„œ๋น„์Šค๊ฐ€ ์ „๋ฐ˜์ ์œผ๋กœ ๋А๋ ค์กŒ์„ ๋•Œ
    • ๋ฐ์ดํ„ฐ ๋ณต์ œ ๊ณผ์ •์—์„œ ๊ธฐ๋ก(WAL)์ด ๊ณ„์† ์Œ“์—ฌ ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•  ๋•Œ

ํ•ต์‹ฌ ์šฉ์–ด (๋น„๊ฐœ๋ฐœ์ž์šฉ)#

์šฉ์–ด์‰ฌ์šด ์„ค๋ช…
RDSAWS๊ฐ€ ๊ด€๋ฆฌํ•ด ์ฃผ๋Š” ๋ฐ์ดํ„ฐ ์ €์žฅ ์ฐฝ๊ณ (๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค) ์„œ๋น„์Šค
PostgreSQL์ด ์ฐฝ๊ณ ๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ ์ •๋ฆฌ ๋ฐฉ์‹(๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ข…๋ฅ˜ ์ค‘ ํ•˜๋‚˜)
Storage / ์Šคํ† ๋ฆฌ์ง€๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์•„ ๋‘๋Š” ์ €์žฅ ๊ณต๊ฐ„(์ฐฝ๊ณ ์˜ ์šฉ๋Ÿ‰)
Storage-Full์ €์žฅ ๊ณต๊ฐ„์ด ๊ฝ‰ ์ฐจ์„œ ๋” ์ด์ƒ ๋ฐ์ดํ„ฐ๋ฅผ ๋ชป ๋„ฃ๋Š” ์ƒํƒœ
Failoverํ•œ์ชฝ์ด ๊ณ ์žฅ ๋‚˜๋ฉด ์ž๋™์œผ๋กœ ์˜ˆ๋น„ ์ชฝ์ด ๋Œ€์‹  ์ผํ•˜๋Š” ๋น„์ƒ ์ „ํ™˜
SnapshotํŠน์ • ์‹œ์ ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ํ†ต์งธ๋กœ ์ฐ์–ด ๋‘” ๋ฐฑ์—… ์‚ฌ์ง„
Replication Slot๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ ๋‚ด์—ญ์„ ๋‹ค๋ฅธ ์‹œ์Šคํ…œ์œผ๋กœ ์‹ค์‹œ๊ฐ„ ๋ณต์‚ฌํ•˜๊ธฐ ์œ„ํ•œ ์—ฐ๊ฒฐ ํ†ต๋กœ
WAL๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ์„ ์ˆœ์„œ๋Œ€๋กœ ์ ์–ด ๋‘๋Š” ๊ธฐ๋ก ์žฅ๋ถ€(์Œ“์ด๋ฉด ๊ณต๊ฐ„์„ ์ฐจ์ง€ํ•จ)
CDC (Change Data Capture)๋ฐ์ดํ„ฐ๊ฐ€ ๋ฐ”๋€” ๋•Œ๋งˆ๋‹ค ๊ทธ ๋ณ€ํ™”๋ฅผ ์žก์•„ ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ๋ณด๋‚ด๋Š” ๋ฐฉ์‹
Multi-AZ๋ฐ์ดํ„ฐ๋ฅผ ๋–จ์–ด์ง„ ๋‘ ๊ณณ์— ๋™์‹œ์— ๋‘์–ด ํ•œ์ชฝ์ด ๊ณ ์žฅ ๋‚˜๋„ ๋ฒ„ํ‹ฐ๊ฒŒ ํ•˜๋Š” ์ด์ค‘ํ™”
Terraform Drift์„ค์ • ๋ฌธ์„œ์— ์ ํžŒ ๋‚ด์šฉ๊ณผ ์‹ค์ œ ์ธํ”„๋ผ๊ฐ€ ์„œ๋กœ ๋‹ฌ๋ผ์ง„ ์ƒํƒœ
CloudWatchAWS ์ž์›์˜ ์ƒํƒœ์™€ ์ง€ํ‘œ๋ฅผ ์ง€์ผœ๋ณด๋Š” ๊ฐ์‹œ ๋Œ€์‹œ๋ณด๋“œ

Covers RDS PostgreSQL fault diagnosis, storage expansion, and replication slot management.

Triggers#

  • Server 502/503 errors (app shows "server maintenance")
  • RDS instance status anomalies (storage-full, modifying, etc.)
  • Database performance degradation
  • Replication slot WAL accumulation

See rules/aws-operations.md for infrastructure debugging order

RDS Storage-Full Response#

Diagnosis#

# 1. Check RDS instance status
aws rds describe-db-instances \
  --db-instance-identifier kobic- < env >   \
  --query  ' DBInstances[0].{Status:DBInstanceStatus,Storage:AllocatedStorage,MaxStorage:MaxAllocatedStorage} ' 

 # 2. FreeStorageSpace metric (last 1 hour)
aws cloudwatch get-metric-statistics \
  --namespace AWS/RDS \
  --metric-name FreeStorageSpace \
  --dimensions Name=DBInstanceIdentifier,Value=kobic- < env >   \
  --start-time $(date -u -v-1H +%Y-%m-%dT%H:%M:%S) \
  --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 300 --statistics Minimum \
  --output table

# 3. Check table sizes after DB connection
SELECT schemaname, tablename,
       pg_size_pretty(pg_total_relation_size(schemaname|| ' . ' ||tablename)) as total_size
FROM pg_tables
WHERE schemaname =  ' public ' 
 ORDER BY pg_total_relation_size(schemaname|| ' . ' ||tablename) DESC
LIMIT 20;

Emergency Storage Expansion#

# Applied immediately, no downtime
aws rds modify-db-instance \
  --db-instance-identifier kobic- < env >   \
  --allocated-storage  < new_size_gb >   \
  --max-allocated-storage  < new_max_gb >   \
  --apply-immediately

Cautions:

  • RDS storage expansion is irreversible (once increased, cannot decrease)
  • 6-hour cooldown after expansion (no further expansion possible)
  • DB operates normally even in storage-optimization state

Terraform Drift Handling#

After emergency expansion, Terraform code and actual infrastructure are out of sync:

# config.auto.tfvars update required
db_configs = {
   " staging "   = {
    allocated_storage       = 200  # Reflect emergency expansion
    max_allocated_storage   = 500  # Reflect emergency expansion
    # ...
  }
}

Replication Slot Management#

CDC (Change Data Capture) replication slots accumulate WAL and consume storage.

-- Check replication slot status
SELECT slot_name, slot_type, active,
       pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) as retained_wal
FROM pg_replication_slots;

-- Delete inactive slots (ClickHouse ClickPipe, etc.)
SELECT pg_drop_replication_slot( ' slot_name_here ' );

RDS Instance Specifications#

Current Configuration (Graviton2 ARM64)#

Environment Instance Class vCPU Memory Storage Max Storage Multi-AZ
Productiondb.t4g.small22GB20GB200GBโœ…
Stagingdb.t4g.small22GB20GB100GBโŒ
Developmentdb.t4g.micro21GB20GB50GBโŒ

See rules/aws-operations.md for CloudWatch alarm status

Checklist#

Storage-Full Response#

  • Check status with aws rds describe-db-instances
  • Check CloudWatch FreeStorageSpace metric
  • Analyze table sizes (pg_total_relation_size)
  • Check replication slot retained WAL
  • Execute emergency storage expansion
  • Update Terraform config.auto.tfvars (separate PR)

Regular Monitoring#

  • Monthly storage utilization check
  • Replication slot WAL size check
  • CloudWatch alarm alarm_actions connection verification