enable-versioning-to-undo-deletes
Use when a stray delete or overwrite has no recovery path. Turns on object versioning with a noncurrent-expiry so overwrites are reversible without unbounded growth.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- enable-versioning-to-undo-deletes
- description
- Use when a stray delete or overwrite has no recovery path. Turns on object versioning with a noncurrent-expiry so overwrites are reversible without unbounded growth.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md359 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Enable Versioning to Undo Deletes
Without versioning, an overwrite or rm is permanent and a bad deploy that rewrites every object is unrecoverable. Versioning keeps prior versions so a delete becomes a soft, reversible event — provided you cap how long noncurrent versions live.
Procedure
- Turn versioning on before you need it:
aws s3api put-bucket-versioning --bucket acme --versioning-configuration Status=Enabled. - Immediately add a
NoncurrentVersionExpirationrule so old versions do not accumulate forever:{"NoncurrentVersionExpiration":{"NoncurrentDays":30}}. - For databases and filesystems, use the native equivalent: WAL + PITR for Postgres (
recovery_target_time), ZFS/Btrfs snapshots for files. - Understand that a delete writes a delete-marker; the data is still there and recoverable by removing the marker:
aws s3api delete-object --bucket acme --key path --version-id <delete-marker-id>. - Recover a specific version:
aws s3api list-object-versions --bucket acme --prefix paththenget-object --version-id. - Add MFA-delete or a bucket policy denying
DeleteObjectVersionoutside a break-glass role, so a compromise or script cannot purge history. - Test the recovery: delete a test object, confirm the current listing hides it, restore the prior version, confirm content matches.
- Re-baseline storage cost after enabling; versioning multiplies stored bytes by the change rate within the retention window.
Pitfalls
- Enabling versioning with no noncurrent expiry, so storage grows without bound and the cost alarm fires months later.
- Believing versioning protects against a malicious actor who has
s3:DeleteObjectVersion— it does not; lock the permission. - A lifecycle rule that deletes noncurrent versions after 1 day, which is too short to catch a slow-failing deploy's overwrites.
- Confusing a delete-marker with the absence of the object;
list-objectshides it butlist-object-versionsstill shows the data. - Assuming versioning replicates to a bucket-replication target automatically; the target's versioning must be enabled too.
- Enabling versioning on a bucket with a huge existing object count and no plan for the first-month cost of retained versions.
- Forgetting that versioning changes ETag semantics and some SDK "overwrite" calls now leave the old bytes billed.
Verification
aws s3api get-bucket-versioning --bucket acme # Status: Enabled
aws s3api list-object-versions --bucket acme --prefix test/key \
--query 'Versions[].VersionId' --output text | wc -w # >1 after edits
Versioning is Enabled, a prior version is retrievable by --version-id, and a NoncurrentVersionExpiration rule bounds retention.
Report: "Versioning enabled on <bucket> with 30d noncurrent expiry; recovered test/key version <id>; delete now reversible within 30 days."
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.