# Event readiness

> Pre-scale ASG, ECS, MIG, and VMSS targets for a planned launch, sale, or load test, and have ZopNight restore the original capacity afterwards.

Source: https://zop.dev/docs/zopnight/optimization/event-readiness

---

Event readiness (**Automate → Event Readiness**) gets you ready for planned spikes such as Black Friday, a product launch, or a load-test window without paying for weeks of idle headroom. You define the event; ZopNight pre-scales the targets ahead of it, runs the event at the scaled capacity, and restores the original configuration afterwards. The capacity calculation reads your autoscaler policy posture and recent activity rather than guessing at headroom.

![Event Readiness page listing planned events as cards with date range, scaling lead time, traffic multiplier, target count, and status (Draft, Scheduled, Active, Completed, Cancelled, Failed), plus Schedule, Edit, Delete, Retry, Cancel, or View actions](https://storage.googleapis.com/zopdev-blog-resources/1/files/originals/20260924/0a97647f-c73f-487a-988c-3d9e9f75e759-eventreadiness.png)

*Automate → Event Readiness: each planned event with its dates, scaling lead time, traffic multiplier, targets, and lifecycle state.*

## Before you start

- **A Read + Write cloud account** for each target, because ZopNight writes cloud-native scheduled actions on them. See [Read-only vs read + write](https://zop.dev/docs/zopnight/cloud-setup/cloud-accounts#read-only-vs-read--write).
- **The event details**: a name, the targets (resources, groups, or cloud accounts), start and end time, timezone, and either a traffic multiplier or an expected peak request rate.
- **Optional:** a notification channel subscribed to **Event Scaling Updates**, if you want a notice at each stage of the event. See [Notifications](#notifications).

## How it works

### When to use it

| Situation | Good fit? |
|---|---|
| Marketing launch with predicted traffic spike | Yes |
| Black Friday or seasonal sale | Yes |
| Scheduled load test | Yes |
| Datastore failover drill | Monitor-only (ZopNight does not modify customer DBs) |
| Unplanned spike happening right now | No; use the autoscaler, not event readiness |
| Permanent capacity increase | No; change the autoscaler policy directly |

### What ZopNight can scale

ZopNight scales infrastructure only. Database scaling stays with your team.

| Target | Provider | What ZopNight does |
|---|---|---|
| **ASG** | AWS | `PutScheduledUpdateGroupAction`; pre-scheduled min/max/desired |
| **ECS service** | AWS | Application Auto Scaling `PutScheduledAction` |
| **MIG** | GCP | `scalingSchedules` on the autoscaler |
| **VMSS** | Azure | Autoscale FixedDate profile |
| **Database** | AWS/GCP/Azure | **Monitor-only.** ZopNight surfaces sizing recommendations (connection-pool math, headroom, suggested tier) but never modifies the database. |

### How the math works

You give ZopNight one of two inputs:

1. **Multiplier**: "I expect 4× baseline traffic"
2. **Expected requests**: "I expect 50,000 RPS at peak"

The capacity engine combines this with:

- Current baseline capacity per target
- Recent activity log signal
- Existing autoscaler policy min/max/target

…and computes per-target `scaledMin / scaledMax / scaledDesired`. You can override any of these in the wizard before scheduling.

**Tip**

Use **multiplier** when the event is a percentage uplift on normal traffic (sales, launches).
Use **expected requests** when you have a hard target (load tests, traffic re-route windows).

### Cost preview

The wizard shows a cost estimate alongside the capacity step, with an **Estimated** badge. It's based on the pricing cache and the scaled capacity; actuals will differ if traffic exceeds the scaled max or comes in under the scaled min.

For the post-save view, `GET /orgs/{orgID}/event-readiness/{id}/cost-estimate` (Bearer-authenticated, same as the other API endpoints) returns the same shape. Use this when you want a cost view on an already-scheduled event without reopening the wizard.

## Create an event

Go to **Automate → Event Readiness** and click **Create Event**.

**Define the event**

  Name, target scope (resources, groups, or specific cloud accounts), start time, end time, and timezone. Name is required and shows up in notifications.

**Pick the capacity input and review each target**

  Multiplier or expected requests. ZopNight pre-fills `scaledMin / scaledMax / scaledDesired` per target straight away, with no save needed, and you can override any cell. The cost preview tile updates live as you edit.

**Review DB impact (monitor-only)**

  If the event scope includes databases, ZopNight shows a sizing recommendation (connection-pool math, suggested tier) but does **not** modify them. Implement the DB changes via your DBA flow before the event.

**Schedule**

  Confirm, and ZopNight writes cloud-native scheduled actions on every target. Nothing polls and no agent is installed.

## Lifecycle

Event state machine: `draft → scheduling → scheduled → scaling_up → active → scaling_down → completed`. Cancellation is terminal; once cancelled, an event cannot be rescheduled (create a new one). Concurrent schedule requests for the same event are rejected.

| State | What it means |
|---|---|
| **draft** | Wizard not yet submitted |
| **scheduling** | ZopNight is writing scheduled actions to the cloud |
| **scheduled** | All cloud-side actions written; waiting for start time |
| **scaling_up** | Start time reached; the cloud is provisioning capacity |
| **active** | At scaled capacity; event window in progress |
| **scaling_down** | End time reached; restoring original capacity |
| **completed** | Restored. Audit log row written. |
| **cancelled** | Terminal. Original capacity restored. |
| **failed** | The event could not complete. Investigate via the event log, then use **Retry** on the event card. |

## Rollback

The `originalMin / originalMax / originalDesired` are snapshotted when the event is scheduled. Whether the event completes normally or you cancel it mid-flight, ZopNight restores the original values.

ZopNight handles these provider quirks for you:

- **GCP cancel** uses `Autoscalers.Update` with `ForceSendFields:["ScalingSchedules"]` to actually delete the schedule (PATCH would silently leave stale schedules).
- **AWS ASG cancel** sweeps every `zopnight-event-*` scheduled action so no orphans leak on partial failures.
- **AWS ECS cancel** calls `DeleteScheduledAction` for every schedule ID and joins errors so partial failures name every action that failed.

## Notifications

Subscribe a channel to **Event Scaling Updates** (**Settings → Notifications → Channels & Alerts**, Automation category) to be told at each stage: scheduled, scaling up, active, scaling down, completed, failed, or cancelled.

A failure notice carries the error from the first target that failed and points you to the event's activity log.

## Audit log

Every state transition is recorded per target in the event's history, and changes you make to the event land in the audit log. When something looks off ("why did this VMSS not scale up at 9am?"), start with that target's history.

## Troubleshooting

**An event shows Failed**

  The failure notification carries the error from the first target that failed, and the event log has the detail per target. Fix the cause, then use **Retry** on the event card.

**A target did not scale up at the start time**

  Open that target's history in the event: every state transition is recorded per target. Start there before checking the cloud console.

**I can**

  Cancellation is terminal and restores the original capacity. Create a new event instead.

**A database in scope was not scaled**

  Databases are monitor-only. ZopNight shows a sizing recommendation (connection-pool math, headroom, suggested tier) but never modifies the database; make the change through your DBA flow before the event.

## Next steps

**Autoscaling**

    Handle recurring and unplanned load with a scaling policy.

**Resource groups**

    Group the targets you pre-scale together.

**Blast radius**

    Check what a change touches before you make it.
