Bảo vệ dữ liệu khỏi thao tác xoá: S3 Versioning, MFA Delete và S3 Object Lock
Một số dữ liệu phải được giữ nguyên trong nhiều năm theo quy định; cần cơ chế ngăn việc xoá hoặc ghi đè, kể cả do nhầm lẫn hay do chính quản trị viên.
Quy định pháp lý yêu cầu MFTECH lưu giữ hoá đơn trong nhiều năm. Rủi ro mất dữ liệu đến từ thao tác xoá nhầm của nhân viên, script dọn dẹp bị lỗi, hoặc chính quản trị viên chủ động xoá. Chọn cơ chế bảo vệ bucket và chủ thể thực hiện xoá, sau đó quan sát lớp bảo vệ nào giữ lại hoá đơn:
Chọn cơ chế bảo vệ và chủ thể xoá, sau đó nhấn Xoá hoá đơn. Bucket giữ nguyên trạng thái (phiên bản, delete marker) giữa các lần xoá cho tới khi đổi cơ chế bảo vệ hoặc nhấn Khôi phục bucket.
Retention period được đặt theo hai cách. Khi chỉ định trực tiếp cho một phiên bản object, request mang một Retain Until Date và S3 lưu ngày đó trong metadata của phiên bản. Khi dùng default retention của bucket, chỉ khai báo một khoảng thời gian (ngày hoặc năm); S3 tính Retain Until Date bằng thời điểm tạo phiên bản cộng khoảng thời gian đó. Nếu request PUT mang retention mode và period riêng, thiết lập riêng này ghi đè default retention của bucket. Retention period có thể được gia hạn bằng một Retain Until Date muộn hơn; với Compliance mode, thời hạn không thể rút ngắn.
Phiên bản v2 có retention chỉ định trong request, nên ghi đè default retention của bucket: v2 khoá tới ngày 75, không phải ngày 45. Phiên bản v1 vẫn giữ thời hạn riêng (ngày 30). Kéo thanh thời gian và thử xoá từng phiên bản.
Retention period gắn với từng phiên bản object, do đó các phiên bản của cùng một key có thể có mode và thời hạn lưu giữ khác nhau. ACL không thay thế được cơ chế này: ACL chỉ xác định account hoặc group nào được cấp quyền truy cập và loại quyền, không có khái niệm thời hạn lưu giữ, nên không dùng để thực thi kiểm soát tuân thủ dạng WORM. Với dữ liệu lưu trong vault của Amazon Glacier (dịch vụ vault độc lập với API riêng từ năm 2012, khác với các storage class S3 Glacier), mỗi vault gắn được một vault access policy và một Vault Lock policy, cả hai viết bằng ngôn ngữ IAM policy. Vault access policy dành cho quyền truy cập thông thường, không liên quan tuân thủ, có thể sửa bất cứ lúc nào. Vault Lock policy dành cho kiểm soát tuân thủ, ví dụ từ chối glacier:DeleteArchive với archive chưa đủ 365 ngày (condition key ArchiveAgeInDays). Khoá vault gồm hai bước: gắn Vault Lock policy để chuyển lock sang trạng thái in-progress và nhận lock ID; trong 24 giờ cần kiểm tra policy rồi dùng lock ID để hoàn tất, nếu quá hạn thì policy bị xoá (khi policy chưa đúng có thể huỷ và làm lại từ đầu). Sau khi hoàn tất, Vault Lock policy không thể thay đổi hoặc xoá. Amazon Glacier không còn nhận khách hàng mới; dữ liệu hiện có vẫn được lưu giữ, và AWS khuyến nghị các storage class S3 Glacier cho lưu trữ dài hạn, nơi yêu cầu WORM do S3 Object Lock đảm nhận.
- Chống xoá nhầm: versioning (thao tác xoá thông thường chỉ thêm delete marker).
- Yêu cầu xác thực bổ sung khi xoá vĩnh viễn: MFA Delete.
- Không ai xoá được, kể cả root: Object Lock Compliance mode.
- Governance mode vẫn cho phép người có quyền bypass thực hiện xoá.
- Lưu giữ không thời hạn, ví dụ khi có tranh chấp: legal hold.
- Default retention của bucket là một khoảng thời gian; retention chỉ định cho phiên bản là một Retain Until Date và ghi đè default.
- Vault của Amazon Glacier: Vault Lock policy (hoàn tất trong 24 giờ, sau đó bất biến), khác vault access policy (sửa được).
Protecting data from deletion: S3 Versioning, MFA Delete and S3 Object Lock
Some data must stay untouched for years by regulation; it needs a mechanism that prevents deletion or overwriting, whether by mistake or by an administrator.
Regulations require MFTECH to keep invoices for many years. The risk of data loss comes from an employee deleting by mistake, a faulty cleanup script, or an administrator deleting on purpose. Choose how the bucket is protected and who deletes, then see which layer of protection keeps the invoice:
Chọn cơ chế bảo vệ và chủ thể xoá, sau đó nhấn Xoá hoá đơn. Bucket giữ nguyên trạng thái (phiên bản, delete marker) giữa các lần xoá cho tới khi đổi cơ chế bảo vệ hoặc nhấn Khôi phục bucket.
A retention period is set in one of two ways. When you apply it explicitly to an object version, the request carries a Retain Until Date, and S3 stores that date in the version’s metadata. With a bucket default retention, you specify only a duration (days or years); S3 computes the Retain Until Date by adding that duration to the version’s creation time. If a PUT request carries its own retention mode and period, those explicit settings override the bucket default. A retention period can be extended with a later Retain Until Date; in Compliance mode it cannot be shortened.
Phiên bản v2 có retention chỉ định trong request, nên ghi đè default retention của bucket: v2 khoá tới ngày 75, không phải ngày 45. Phiên bản v1 vẫn giữ thời hạn riêng (ngày 30). Kéo thanh thời gian và thử xoá từng phiên bản.
Retention periods apply to individual object versions, so versions of the same key can have different retention modes and periods. ACLs cannot replace this mechanism: an ACL only defines which accounts or groups are granted access and the type of access; it has no notion of a retention period, so it cannot enforce WORM compliance controls. For data stored in an Amazon Glacier vault (a standalone vault service with its own API from 2012, distinct from the S3 Glacier storage classes), each vault can have one vault access policy and one Vault Lock policy, both written in the IAM policy language. The vault access policy is for ordinary access controls that are not compliance related and can be changed at any time. The Vault Lock policy is for compliance controls, for example denying glacier:DeleteArchive for archives younger than 365 days (condition key ArchiveAgeInDays). Locking a vault takes two steps: attaching the Vault Lock policy puts the lock in the in-progress state and returns a lock ID; within 24 hours you validate the policy and complete the lock with that lock ID, otherwise the policy is deleted (if the policy is not right, you can stop and restart the process). Once completed, the Vault Lock policy can no longer be changed or deleted. Amazon Glacier is no longer open to new customers; existing data remains stored, and AWS recommends the S3 Glacier storage classes for long-term archives, where S3 Object Lock provides WORM protection.
- Protect against accidental deletes: versioning (a simple delete only adds a delete marker).
- Require extra authentication for permanent deletes: MFA Delete.
- No one can delete, including root: Object Lock Compliance mode.
- Governance mode still lets users with bypass permission delete.
- Retention with no end date, for example during a dispute: legal hold.
- A bucket default retention is a duration; an explicit retention on a version is a Retain Until Date and overrides the default.
- Amazon Glacier vaults: a Vault Lock policy (completed within 24 hours, immutable afterwards), unlike a vault access policy (can be changed).