# Rds Backup Restore Operator

> Operates RDS and Aurora backup and restore workflows safely — automated backup window configuration, manual snapshots for pre-maintenance safety, cross-region and cross-account snapshot copy, point-in-time restore (PITR), Aurora Backtrack for in-place rewind, S3 export/import, and full post- restore verification. Runs deterministic pre-checks (subnet group, security group, option group, KMS key, instance status), executes the operation behind a CONFIRM gate, and emits a verdict (READY | BLOCKED | COMPLETED) per operation with the exact CLI sequence, expected side-effects (new instance endpoint, connection-string updates), and verification commands. Use when configuring RDS backup retention, creating pre-migration snapshots, restoring to a point in time, backtracking an Aurora cluster, exporting a snapshot to S3, or recovering from a bad change.

- Skill: `jhkchan/rds-backup-restore-operator` (Agent Skill, multi-file: 20 files)
- Install (CLI): `npx get-skill add jhkchan/rds-backup-restore-operator`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jhkchan/rds-backup-restore-operator/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- License: Apache-2.0
- Author: jhkchan (https://skillmd.com/u/jhkchan)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/jhkchan/rds-backup-restore-operator

---


# RDS Backup Restore Operator

## What this skill does

Executes RDS/Aurora backup and restore operations correctly and safely.
Runs deterministic pre-checks before any state-changing CLI, executes the
operation behind a CONFIRM gate, and verifies the result. Every restore
produces a NEW endpoint (except Aurora Backtrack, which is in-place) — the
skill always surfaces the connection-string update step.

## Quick navigation

| Section | What it covers | When to read it |
|---|---|---|
| **§ Quick reference** | Verdict thresholds (BLOCKED/READY/COMPLETED) + pre-check priority order | Before any operation |
| **§ Mindset** | Why pre-checks matter, the new-endpoint surprise, the confirm gate | Understanding the safety model |
| **§ Pre-flight** | Instance metadata gate — status, retention, snapshot, VPC resources | Before executing any CLI |
| **§ Process** | Per-operation planning: backup, snapshot, PITR, backtrack, S3 export/import | When choosing which operation to run |
| **§ Output format** | Structured output template with VERDICT, COMMANDS, ENDPOINT, VERIFICATION | Formatting the response |
| **§ Anti-Patterns** | NEVER list — common mistakes that cause data loss or silent failures | Review before risky operations |
| **§ Pre-flight safety** | Additional checks before any remediation CLI | Defense-in-depth |

## Quick reference — verdict thresholds

| Verdict | Trigger condition | Action |
|---|---|---|
| `BLOCKED` | One or more pre-checks failed (missing subnet/SG/option group, retention=0 for PITR, instance not available, KMS key inaccessible) | List failures, do NOT execute |
| `READY` | All pre-checks passed; awaiting CONFIRM gate | Emit exact CLI sequence, wait for operator yes |
| `COMPLETED` | Operation finished and post-verification passed | Emit endpoint, verification results, cleanup steps |

**Priority order for pre-checks (apply in this sequence, all must pass for
READY):**

1. **Instance/cluster status** — must be `available` (or `backing-up` for
   read operations). `modifying`, `upgrading`, `creating`, `deleting` → BLOCKED.
2. **Backup retention** — PITR requires retention > 0; otherwise BLOCKED with
   "PITR disabled".
3. **Snapshot existence** — restore operations require an existing snapshot
   or a valid PITR window.
4. **Target VPC resources** — subnet group, security group, option group,
   parameter group, KMS key all must exist in the target.
5. **Capacity and quota** — DB instance class available in target AZ,
   snapshot copy quota not exceeded.

**Cost/time baselines (2026):**

- Snapshot create time: ~1 min per 100 GB (storage-bound).
- Snapshot restore time: ~30-90 min for 1 TB (proportional to data size).
- Aurora Backtrack: seconds to minutes, regardless of cluster size.
- Cross-region snapshot copy: data-transfer fee ($0.02/GB cross-region) +
  destination-region storage.
- S3 export: ~$0.025/GB-hour for the export task; writes Parquet to S3.

## Mindset

**One-line takeaway:** restore always creates a new instance with a new
endpoint — except Aurora Backtrack, which is an in-place rewind. Driven by
three RDS realities:

- **Restore is non-destructive by default.** `restore-db-instance-to-point-in-time`
  and `restore-db-instance-from-db-snapshot` create a NEW instance with a NEW
  endpoint. The original is unchanged. Operators who expect an in-place rewind
  are surprised by the new endpoint and the duplicate instance bill.
- **PITR requires retention > 0.** Setting `BackupRetentionPeriod: 0` disables
  automated backups entirely AND disables PITR. The 5-minute transaction log
  shipping stops; the recovery point reverts to the last manual snapshot.
- **Aurora Backtrack is the only in-place rewind.** Aurora MySQL clusters with
  `BacktrackWindow` > 0 can rewind in seconds without restoring from a
  snapshot. Aurora PostgreSQL does NOT support Backtrack — use PITR or fast
  clone instead.

## Pre-flight: instance metadata gate

Run before classification. Misclassifying these produces wrong plans.

**Pagination:** `describe-db-instances` paginates at 100/page — drain
`--marker` (or `--starting-token` for the AWS CLI v2 pagination syntax) to
completion. `describe-db-snapshots` paginates at 100/page similarly.

**Live-account pre-flight (skip if offline plan audit):**
Live-account pre-flight commands 1-8 moved verbatim to
[references/diagnostic-commands.md](references/diagnostic-commands.md).

**Malformed input:** if the input JSON is invalid or missing required fields,
emit `VERDICT: ERROR` with `REASON: Instance/operation configuration is not
valid JSON or is missing required fields — cannot plan.` and
`REMEDIATION: Re-fetch with aws rds describe-db-instances --db-instance-identifier
<id> --output json and re-plan.`

| Instance attribute | Effect on operation |
|---|---|
| `DBInstanceStatus: available` | Pre-check passes for stateful operations. |
| `DBInstanceStatus: modifying, upgrading, creating, deleting, backing-up` | BLOCKED — wait for `available` (or `storage-optimization` for non-stateful ops). |
| `DBInstanceStatus: failed, incompatible-restore` | BLOCKED — instance cannot serve as restore source. |
| `MultiAZ: true` | Automated backups run from the standby for MySQL/PostgreSQL; no perf impact on primary. |
| `StorageEncrypted: true` | Restore requires KMS key access in the target. Cross-account restore needs the source account's KMS key policy grant. |
| `BackupRetentionPeriod: 0` | PITR BLOCKED — automated backups disabled. Only manual snapshot restore is available. |
| `BackupRetentionPeriod: 1-35` | PITR window is `now - retention` to `~5 min ago`. |
| `Engine: aurora-mysql` | Backtrack available if `BacktrackWindow > 0`. Fast clone available. |
| `Engine: aurora-postgresql` | Backtrack NOT supported. Use PITR or fast clone. |
| `Engine: mysql, postgres, oracle, sqlserver, mariadb` | Standard RDS; no Backtrack, no fast clone. |
| `DBSubnetGroup` missing or `Subnets: []` | Restore BLOCKED — no target subnets. |
| `OptionGroupMemberships` referencing deleted option group | Restore BLOCKED — create matching option group first. |
| `DBParameterGroups` referencing deleted parameter group | Restore BLOCKED — create matching parameter group first. |
| `GlobalClusterMember` (Aurora Global Database) | Restoring a primary requires promoting a secondary or removing from global cluster first. |
| `ActivityStreamStatus: started` (Database Activity Streams) | Restore BLOCKED — stop the activity stream first; resume after restore. |
| `ReplicaSource` set (read replica) | Restoring a read replica is unusual; surface as a finding. |

## Process — operation planning (apply in order)

### Step 0: Expert knowledge — non-obvious RDS/Aurora behaviors

Step 0 expert-knowledge catalog (non-obvious RDS/Aurora behaviors) moved verbatim to
[references/advanced-patterns.md](references/advanced-patterns.md).

### Step 1: Pre-check gate — BLOCKED if any check fails

Run ALL of the following pre-checks. If ANY fails, the verdict is BLOCKED
with the failed checks enumerated in PRE_CHECKS. Do NOT execute the
operation.

**For ALL operations:**
1. `DBInstanceStatus` (or `DBClusterStatus` for Aurora) is `available` (or
   `backing-up`/`storage-optimization` for read-only operations).
2. The operation is not already in progress (no concurrent snapshot create
   for the same instance).
3. IAM role for the operator holds the required RDS permissions.
4. Service quota for the operation is not exceeded (snapshot quota, instance
   quota, copy quota).

**For snapshot create (`create-db-snapshot`):**
5. Instance is in `available` state (not `modifying` or `creating`).
6. No existing manual snapshot with the same `--db-snapshot-identifier`.

**For PITR restore (`restore-db-instance-to-point-in-time`):**
5. `BackupRetentionPeriod > 0` on the source instance.
6. `LatestRestorableTime` >= `--restore-time` >= `EarliestRestorableTime`.
7. Target `--db-instance-identifier` does NOT already exist (restore creates
   a new identifier).
8. Target DB subnet group exists and has subnets in >= 2 AZs (recommended).
9. Target security group exists in the same VPC as the subnet group.
10. Target option group matches the engine + engine-version.
11. Target parameter group matches the engine + engine-version.
12. KMS key (if encrypted) is accessible: `kms:Decrypt`, `kms:CreateGrant`.

**For snapshot restore (`restore-db-instance-from-db-snapshot`):**
5. Snapshot exists (`describe-db-snapshots --db-snapshot-identifier <id>`).
6. Snapshot status is `available`.
7. Target `--db-instance-identifier` does NOT already exist.
8. Target DB subnet group, security group, option group, parameter group,
   KMS key — all exist and match.

**For Aurora backtrack (`backtrack-db-cluster`):**
5. Engine is `aurora-mysql` (PostgreSQL does NOT support backtrack).
6. `BacktrackWindow` > 0 on the cluster.
7. `--backtrack-to-timestamp` is within `[now - BacktrackWindow, now]`.
8. Cluster is NOT in a Global Database as the writer ( backtrack a writer in
   a global cluster requires special handling — surface as a finding).
9. No existing backtrack in progress for the cluster.

**For S3 export (`start-export-task`):**
5. Snapshot exists and is `available`.
6. `--role-arn` trusts `rds.amazonaws.com`.
7. `--s3-bucket-name` exists and the role has `s3:PutObject` + `s3:ListBucket`.
8. KMS key (if specified) is accessible to the role.

**For S3 import (`start-import-from-s3`):**
5. Target Aurora MySQL cluster exists and is `available`.
6. Source S3 bucket is in the same region as the cluster.
7. The cluster's role has `s3:GetObject` + `s3:ListBucket` on the source.
8. The data format matches `--type` (CSV, etc.).

### Step 2: READY — emit operation plan

If all pre-checks pass, emit `VERDICT: READY` with the exact CLI sequence
and the CONFIRM gate. The plan includes:

- The exact AWS CLI command with all flags populated from the source instance
  configuration.
- The expected duration (snapshot create ~1 min/100 GB, restore 30-90 min/TB,
  backtrack seconds-to-minutes).
- The expected side-effects (new endpoint for restore, in-place rewind for
  backtrack, new export task ID for S3 export).
- The CONFIRM gate prompt.

### Step 3: Execute behind CONFIRM gate

- **MANDATORY CONFIRMATION GATE.** Before any state-changing CLI, emit:
  `CONFIRM: About to <operation> on <instance/cluster/snapshot> in account
  <account> region <region>. This will <consequence>. Proceed? (yes/no)`.
  Do NOT execute until the operator confirms.
- Capture pre-state for rollback: `aws rds describe-db-instances --db-instance-identifier
  <id> --output json > /tmp/<id>-pre-$(date +%s).json`.
- Execute the CLI. Capture the operation ID (snapshot ID, restore ARN,
  backtrack ID, export task ID).
- For long-running operations, wait via `aws rds wait db-instance-available
  --db-instance-identifier <new-id>` (or the appropriate waiter).

### Step 4: Post-verification — COMPLETED

After the operation finishes, run post-verification. ALL checks must pass
for `COMPLETED`.

1. `describe-db-instances --db-instance-identifier <new-id>` — confirm
   `DBInstanceStatus: available`.
2. Test connectivity to the new endpoint: `psql`, `mysql`, or `sqlcmd` as
   appropriate. The endpoint is in the `Endpoint.Address` field.
3. Verify data consistency: row count on a known table, checksum on a known
   dataset, or query a sentinel row.
4. Verify the restore point matches the intended time (for PITR).
5. Verify option group, parameter group, security group applied correctly.
6. Surface the connection-string update step (new endpoint).
7. Clean up temporary instances if the operation was a verification restore.
8. For backtrack: verify the cluster rewound to the target timestamp via
   CloudTrail or a sentinel row.

If ANY verification fails, emit `VERDICT: ERROR` with the failure details —
do not claim COMPLETED.

## Output format (per operation)

```text
OPERATION: <create-snapshot | pitr-restore | snapshot-restore | backtrack | export | import>
VERDICT: READY | BLOCKED | COMPLETED
TARGET: <instance-id, cluster-id, snapshot-id>
PRE_CHECKS:
  - [PASS] <check description>
  - [FAIL] <check description> — <reason>
STEPS:
  1. <CLI command with flags populated>
  2. <wait command>
  3. <next step>
POST_VERIFY:
  - [PASS] <verification description>
  - [FAIL] <verification description> — <reason>
ENDPOINT: <new endpoint if restore, "unchanged" if backtrack>
NOTES: <connection-string update, cleanup, caveats>
```

### Worked example — PITR restore

```text
OPERATION: pitr-restore
VERDICT: READY
TARGET: prod-orders-db -> prod-orders-db-pitr-2026-08-07
PRE_CHECKS:
  - [PASS] prod-orders-db DBInstanceStatus is available
  - [PASS] BackupRetentionPeriod is 7 (> 0, PITR enabled)
  - [PASS] RestoreTime 2026-08-07T10:00:00Z is within window
    [2026-07-31T00:00:00Z, 2026-08-07T10:55:00Z]
  - [PASS] Target identifier prod-orders-db-pitr-2026-08-07 does not exist
  - [PASS] DB subnet group prod-subnet-group has subnets in 3 AZs
  - [PASS] Security group sg-prod-rds exists in vpc-vpc-12345
  - [PASS] Option group default:mysql-8-0 matches engine mysql 8.0.x
  - [PASS] Parameter group prod-mysql80 matches engine mysql 8.0.x
  - [PASS] KMS key arn:aws:kms:us-east-1:111111111111:key/prod-key accessible
STEPS:
  1. CONFIRM: About to restore-db-instance-to-point-in-time on prod-orders-db
     to 2026-08-07T10:00:00Z, creating prod-orders-db-pitr-2026-08-07 in
     account 111111111111 region us-east-1. This will create a new instance
     with a new endpoint (original unchanged). Estimated duration: 60-90
     minutes. Proceed? (yes/no)
  2. aws rds restore-db-instance-to-point-in-time \
       --source-db-instance-identifier prod-orders-db \
       --target-db-instance-identifier prod-orders-db-pitr-2026-08-07 \
       --restore-time 2026-08-07T10:00:00Z \
       --db-subnet-group-name prod-subnet-group \
       --vpc-security-group-ids sg-prod-rds \
       --option-group-name default:mysql-8-0 \
       --db-parameter-group-name prod-mysql80 \
       --no-deletion-protection \
       --tags Key=restored-from,Value=prod-orders-db Key=restore-reason,Value=bad-migration
  3. aws rds wait db-instance-available \
       --db-instance-identifier prod-orders-db-pitr-2026-08-07
POST_VERIFY:
  - (pending execution)
ENDPOINT: (pending — will be prod-orders-db-pitr-2026-08-07.<random>.us-east-1.rds.amazonaws.com)
NOTES:
  - The new instance has a NEW endpoint. Update application connection strings.
  - The original prod-orders-db is unchanged and continues to bill.
  - Set --deletion-protection on the new instance once verified.
  - Plan cleanup: delete the restored instance after migration cutover.
```

### Worked example — pre-check failure

The pre-check-failure (BLOCKED) worked example moved verbatim to
[references/worked-examples.md](references/worked-examples.md).

### Worked example — Aurora backtrack

The Aurora backtrack worked example moved verbatim to
[references/worked-examples.md](references/worked-examples.md).

## Anti-Patterns — NEVER

- NEVER execute `restore-db-instance-to-point-in-time` or
  `restore-db-instance-from-db-snapshot` without explicitly surfacing that
  a NEW instance and NEW endpoint will be created. Operators who expect an
  in-place rewind will miss the connection-string update step and break
  their application.

- NEVER attempt PITR on an instance with `BackupRetentionPeriod: 0`. There
  are no transaction logs and no recoverable window. Always check retention
  first and BLOCK with the modify-db-instance remediation if PITR is the
  goal.

- NEVER assume Aurora PostgreSQL supports Backtrack. Only Aurora MySQL
  supports Backtrack. For Aurora PostgreSQL, use PITR or fast clone.

- NEVER execute `restore-db-instance-to-point-in-time` with
  `--restore-time` outside the retention window. Always verify
  `LatestRestorableTime` and `EarliestRestorableTime` via
  `describe-db-instances` first; the API returns
  `InvalidParameterValue` if outside the window.

- NEVER skip the target-resource pre-checks (subnet group, security group,
  option group, parameter group, KMS key). A restore with a missing subnet
  group fails after the snapshot download — wasting 30+ minutes. Always
  verify all target resources exist before executing.

- NEVER share an encrypted snapshot cross-account without verifying the KMS
  key policy grants the recipient `kms:Decrypt` and `kms:CreateGrant`. The
  snapshot share alone is insufficient — the recipient can describe the
  snapshot but cannot restore from it.

- NEVER copy a snapshot cross-region without surfacing the cost. Cross-region
  copy bills $0.02/GB data transfer plus destination-region storage. A 1 TB
  snapshot copied to 3 DR regions is $60 in transfer + 3 TB-month of
  destination storage.

- NEVER delete the original instance after a PITR or snapshot restore until
  the new instance is verified AND application traffic is cut over. Restore
  is non-destructive by design; deleting the original prematurely is the
  most common cause of prolonged downtime during recovery.

- NEVER recommend setting `BackupRetentionPeriod: 0` to "save backup costs."
  This disables PITR entirely and is irreversible for the unbacked-up
  period. The cost saving is negligible; the recovery exposure is total.

- NEVER restore into the same DB subnet group with insufficient AZs. RDS
  recommends subnets in >= 2 AZs for Multi-AZ; restoring into a single-AZ
  subnet group blocks Multi-AZ and reduces availability.

- NEVER skip the post-restore verification. A restore that returns
  `available` may still have data inconsistency (partial transaction log
  replay, parameter group mismatch). Always verify with a row count,
  checksum, or sentinel query.

- NEVER execute `backtrack-db-cluster` on a writer in an Aurora Global
  Database without special handling. Backtracking the writer can desync
  the global cluster — surface as a finding and recommend detaching from
  the global cluster first.

- NEVER assume Aurora Fast Clone is free. The clone shares storage at
  creation (instant), but divergent writes accrue new storage — a long-
  lived clone can double the storage bill. Always plan clone cleanup.

- NEVER auto-execute a state-changing RDS CLI without the CONFIRM gate.
  Restore, snapshot create, backtrack, and export all have side effects
  (new instance bill, in-place rewind, export task charges). Always emit
  CONFIRM and wait.

- NEVER trust `describe-db-instances` `DBInstanceStatus: available` alone
  for PITR readiness. An instance can be `available` with retention=0
  (no automated backups). Always check `BackupRetentionPeriod` and
  `LatestRestorableTime` independently.

## Pre-flight safety checks (run before any remediation CLI)

The full pre-flight safety check catalog (confirm gate, pre-state capture,
target/retention/KMS verification) moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).

## Recent AWS features (2024-2026)

Recent AWS feature notes (2024-2026) moved verbatim to
[references/advanced-patterns.md](references/advanced-patterns.md).

## References (load on demand)

- [references/worked-examples.md](references/worked-examples.md) — the BLOCKED pre-check-failure and Aurora backtrack worked examples (moved from this file; the PITR worked example stays in this file)
- [references/diagnostic-commands.md](references/diagnostic-commands.md) — live-account pre-flight commands 1-8, pre-flight safety check catalog with confirm-gate and rollback capture (moved from this file)
- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 expert-knowledge catalog of non-obvious RDS/Aurora behaviors, recent AWS features 2024-2026 (moved from this file)
- [references/restore-procedures.md](references/restore-procedures.md) — per-operation CLI procedures: PITR, snapshot restore, Aurora backtrack, fast clone, cross-region copy

## Domain

AWS CloudOps / RDS & Aurora Backup, Restore & Disaster Recovery.

## AWS documentation

- **Amazon RDS User Guide** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html
- **Amazon Aurora User Guide** — https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html
- **Backing up and restoring** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_CommonTasks.BackupRestore.html
- **Aurora Backtrack** — https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html
- **Point-in-time recovery** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIT.html
- **Amazon RDS Security** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.html
- **AWS CLI Command Reference: rds** — https://docs.aws.amazon.com/cli/latest/reference/rds/
- **RDS Blue/Green Deployments** — https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html
- **Aurora Fast Database Clone** — https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Managing.FastClone.html

