68 / 75 · 08 Infrastructure as Code Testing · Ephemeral Environments← prev⊞ allnext →☰ Read as one page
12.6Database Seeding for Ephemeral Environments
Ephemeral environments need data to be useful. Options from fastest to most realistic:
| Approach | Speed | Realism | Best For |
|---|---|---|---|
| Empty schema only | Seconds | Low | API testing with test data creation |
| Fixture data (SQL scripts) | Seconds | Medium | Predictable test scenarios |
| Anonymized production snapshot | Minutes | High | Realistic testing, demo environments |
| Production read replica | Fast (no copy) | Highest | Read-only testing against real data |
# Seed ephemeral database from fixture files
psql "$DATABASE_URL" < fixtures/schema.sql
psql "$DATABASE_URL" < fixtures/test-data.sql
Ephemeral environments transform testing confidence because they eliminate the "works in staging" problem. When every PR gets its own infrastructure, you know exactly what changed and whether it works.