RDS Incident Response and Operations#
ํ๋ง๋๋ก (๋น๊ฐ๋ฐ์์ฉ)#
์ด ์คํฌ์ ์๋น์ค์ ๋ฐ์ดํฐ๊ฐ ์ ์ฅ๋๋ "์ฐฝ๊ณ (๋ฐ์ดํฐ๋ฒ ์ด์ค)"์ ๋ฌธ์ ๊ฐ ์๊ฒผ์ ๋ ๋์ํ๋ ์๊ธ ๋งค๋ด์ผ์ ๋๋ค. ์ฐฝ๊ณ ๊ฐ ๊ฝ ์ฐจ๊ฑฐ๋, ๊ฐ์๊ธฐ ๋๋ ค์ง๊ฑฐ๋, ์๋(์ฌ์ฉ์)์ด "๊ณต์ฌ ์ค" ํ๋ฉด์ ๋ณด๊ฒ ๋๋ ์ํฉ์ ๋น ๋ฅด๊ฒ ์ง๋จํ๊ณ ํด๊ฒฐํ๋๋ก ๋์ต๋๋ค. ๋ง์น ๊ฑด๋ฌผ ๊ด๋ฆฌ์ธ์ด ์ ์ ์ด๋ ๋์์ ๋๋นํ ๋์ ์ ์ฐจ๋ฅผ ๋ฏธ๋ฆฌ ์ ๋ฆฌํด ๋ ๊ฒ๊ณผ ๋น์ทํฉ๋๋ค.
๋ฌด์์ยท์ธ์ (๋น๊ฐ๋ฐ์์ฉ)#
-
๋ฌด์์ ํด ์ฃผ๋์
- ๋ฐ์ดํฐ ์ฐฝ๊ณ (RDS)์ ์ํ๋ฅผ ์ ๊ฒํ๊ณ , ์ ์ฅ ๊ณต๊ฐ์ด ๋ถ์กฑํ๋ฉด ์ฆ์ ๋๋ ค ์ค๋๋ค.
- ๋ฐ์ดํฐ๋ฒ ์ด์ค๊ฐ ๋๋ ค์ง๊ฑฐ๋ ๋ฉ์ท์ ๋ ์์ธ์ ์ฐพ์๋ ๋๋ค.
- ์์ฌ์ ๊ณต๊ฐ์ ์ก์๋จน๋ ๋ถํ์ํ ๊ธฐ๋ก์ ์ ๋ฆฌํฉ๋๋ค.
- ์๊ธ ์กฐ์น ํ ์ค์ ๋ฌธ์(์ธํ๋ผ ์ฝ๋)์ ์ค์ ์ํ๊ฐ ์ด๊ธ๋์ง ์๋๋ก ๋ง์ถฐ ์ค๋๋ค.
-
์ธ์ ์๋ํ๋์
- ํ๋ฉด์ 502/503 ์ค๋ฅ๋ "์๋ฒ ์ ๊ฒ ์ค" ์๋ด๊ฐ ๋ฐ ๋
- ๋ฐ์ดํฐ ์ฐฝ๊ณ ๊ฐ ๊ฑฐ์ ๋ค ์ฐผ๊ฑฐ๋ ์ํ๊ฐ ์ด์ํ ๋(storage-full ๋ฑ)
- ์๋น์ค๊ฐ ์ ๋ฐ์ ์ผ๋ก ๋๋ ค์ก์ ๋
- ๋ฐ์ดํฐ ๋ณต์ ๊ณผ์ ์์ ๊ธฐ๋ก(WAL)์ด ๊ณ์ ์์ฌ ๊ณต๊ฐ์ ์ฐจ์งํ ๋
ํต์ฌ ์ฉ์ด (๋น๊ฐ๋ฐ์์ฉ)#
| ์ฉ์ด | ์ฌ์ด ์ค๋ช |
|---|---|
| RDS | AWS๊ฐ ๊ด๋ฆฌํด ์ฃผ๋ ๋ฐ์ดํฐ ์ ์ฅ ์ฐฝ๊ณ (๋ฐ์ดํฐ๋ฒ ์ด์ค) ์๋น์ค |
| PostgreSQL | ์ด ์ฐฝ๊ณ ๊ฐ ์ฌ์ฉํ๋ ๋ฐ์ดํฐ ์ ๋ฆฌ ๋ฐฉ์(๋ฐ์ดํฐ๋ฒ ์ด์ค ์ข ๋ฅ ์ค ํ๋) |
| Storage / ์คํ ๋ฆฌ์ง | ๋ฐ์ดํฐ๋ฅผ ๋ด์ ๋๋ ์ ์ฅ ๊ณต๊ฐ(์ฐฝ๊ณ ์ ์ฉ๋) |
| Storage-Full | ์ ์ฅ ๊ณต๊ฐ์ด ๊ฝ ์ฐจ์ ๋ ์ด์ ๋ฐ์ดํฐ๋ฅผ ๋ชป ๋ฃ๋ ์ํ |
| Failover | ํ์ชฝ์ด ๊ณ ์ฅ ๋๋ฉด ์๋์ผ๋ก ์๋น ์ชฝ์ด ๋์ ์ผํ๋ ๋น์ ์ ํ |
| Snapshot | ํน์ ์์ ์ ๋ฐ์ดํฐ๋ฅผ ํต์งธ๋ก ์ฐ์ด ๋ ๋ฐฑ์ ์ฌ์ง |
| Replication Slot | ๋ฐ์ดํฐ ๋ณ๊ฒฝ ๋ด์ญ์ ๋ค๋ฅธ ์์คํ ์ผ๋ก ์ค์๊ฐ ๋ณต์ฌํ๊ธฐ ์ํ ์ฐ๊ฒฐ ํต๋ก |
| WAL | ๋ฐ์ดํฐ ๋ณ๊ฒฝ์ ์์๋๋ก ์ ์ด ๋๋ ๊ธฐ๋ก ์ฅ๋ถ(์์ด๋ฉด ๊ณต๊ฐ์ ์ฐจ์งํจ) |
| CDC (Change Data Capture) | ๋ฐ์ดํฐ๊ฐ ๋ฐ๋ ๋๋ง๋ค ๊ทธ ๋ณํ๋ฅผ ์ก์ ๋ค๋ฅธ ๊ณณ์ผ๋ก ๋ณด๋ด๋ ๋ฐฉ์ |
| Multi-AZ | ๋ฐ์ดํฐ๋ฅผ ๋จ์ด์ง ๋ ๊ณณ์ ๋์์ ๋์ด ํ์ชฝ์ด ๊ณ ์ฅ ๋๋ ๋ฒํฐ๊ฒ ํ๋ ์ด์คํ |
| Terraform Drift | ์ค์ ๋ฌธ์์ ์ ํ ๋ด์ฉ๊ณผ ์ค์ ์ธํ๋ผ๊ฐ ์๋ก ๋ฌ๋ผ์ง ์ํ |
| CloudWatch | AWS ์์์ ์ํ์ ์งํ๋ฅผ ์ง์ผ๋ณด๋ ๊ฐ์ ๋์๋ณด๋ |
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.mdfor 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-optimizationstate
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 |
|---|---|---|---|---|---|---|
| Production | db.t4g.small | 2 | 2GB | 20GB | 200GB | โ |
| Staging | db.t4g.small | 2 | 2GB | 20GB | 100GB | โ |
| Development | db.t4g.micro | 2 | 1GB | 20GB | 50GB | โ |
See
rules/aws-operations.mdfor 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