Environment Reset
Resetting an ephemeral environment to a clean, seeded baseline is a single command. Instead of hand-assembling the wipe-runner invocation and the env-seed step (and verifying each through CloudWatch), run pnpm script reset-environment and read its output.
When to use it
- Before a demo on an ephemeral (
pr0001–pr9999) environment, so you start from the known-good integration baseline. - Any time an ephemeral environment's data has drifted and you want it reset.
This command is ephemeral-only. It refuses integration and production before touching any data.
Prerequisites
- Your
.envpoints at the target environment:pnpm script update-env <N>. AWS_PROFILEandAWS_REGIONare set in.env.- Your AWS identity has
lambda:InvokeFunctionon the environment'swipe-runnerfunction (see Deploy Role Permissions).
The command
pnpm script update-env <N> # once, to point .env at the target
pnpm script reset-environment <N> # wipe + reseed in one step
What it does
- Wipes PostgreSQL via the in-VPC
wipe-runnerLambda (invoked withforce). - Reseeds Cognito users from
integration, the same baseline a fresh ephemeral deploy seeds. The optional S3 copy step in reseed logs a no-op when there is no content bucket to copy.
The command prints the wipe stats, a reseed-complete line, and a final ✅ Environment "<env>" reset (wiped + reseeded) successfully.
Failure behavior
If either half fails, the command exits non-zero and prints the failing step (❌ Reset FAILED during wipe … or ❌ Reset FAILED during reseed …) with the underlying cause. A failed wipe never proceeds to reseed. Nothing is silently swallowed, matching the loud env-seed behavior in the deploy pipeline.
Caveats
- Ephemeral only. Integration and production are refused up front.
- CI can re-dirty the environment. If CI redeploys or reruns against the same environment after you reset it, it can repopulate test data. Run the reset immediately before your demo.
- Baseline scope. The reseed copies Cognito users. Postgres tables are truncated by the wipe but not repopulated by the baseline seed, matching deploy-time ephemeral seeding in this repository.