c2.3 Protect training-data integrity with S3 Object Lock and versioning
Keep training datasets tamper-evident and recoverable so poisoned or altered data can be detected and rolled back.
Implementation guidance
How to implement on AWS
Store training and validation data in S3 with versioning and, where appropriate, Object Lock, so modifications are tracked and immutable audit records exist. Restrict write access with resource-based policies and log all access.
Make training data tamper-evident and recoverable
If an attacker (or a mistake) alters your training set, a model fine-tuned on it inherits the damage — data poisoning is hard to detect after the fact. Two S3 features make the dataset defensible:
- Versioning keeps every version of an object, so an overwrite or delete never destroys the original — you can roll back to a known-good version.
- Object Lock enforces write-once-read-many (WORM): a locked object version cannot be overwritten or deleted until its retention period expires.
Object Lock only works on a versioned bucket, and versioning is enabled automatically when you enable Object Lock.
Enable versioning, then a default retention
Turn on versioning and set a default Object Lock retention so new training objects are protected automatically:
# Versioning first (Object Lock requires it)
aws s3api put-bucket-versioning \
--bucket my-bedrock-training-data \
--versioning-configuration Status=Enabled
# Default WORM retention: 30 days in GOVERNANCE mode
aws s3api put-object-lock-configuration \
--bucket my-bedrock-training-data \
--object-lock-configuration '{
"ObjectLockEnabled": "Enabled",
"Rule": { "DefaultRetention": { "Mode": "GOVERNANCE", "Days": 30 } }
}'
Choose the right retention mode
- GOVERNANCE — objects are protected, but users with the
s3:BypassGovernanceRetentionpermission can still remove the lock. Good default for tamper-evidence without locking yourself out. - COMPLIANCE — no one, not even the root account, can shorten the retention or delete the version until it expires. Use only when you are certain about the retention period, since it cannot be undone.
DefaultRetention accepts either Days or Years — not both.
Pair it with integrity checks
WORM protects against tampering after upload; also record a checksum (e.g. an S3 checksum or a manifest hash) when you ingest a dataset, so you can prove the exact bytes a given model version was trained on. Combine with the customization CMK control so the protected data is also encrypted under your key.
Naming note: replace the bucket name and tune the retention window to your data-governance policy. Test with GOVERNANCE before considering COMPLIANCE.
Acceptance criteria
Training buckets have versioning (and Object Lock where required); access is restricted and logged; prior dataset versions are recoverable.
Practical implementation
How this control is implemented in each reference architecture:
Training data lives in versioned, Object-Lock S3 buckets in the Generative AI account, with writes restricted and every access logged to the Log archive.
- Enable versioning and, for datasets that must be immutable, Object Lock on the training/validation S3 buckets in the Generative AI account.
- Restrict write access with a resource-based bucket policy to only the data-curation role, and deny deletes to the customization job role.
- Send S3 data-event access logs to the central Log archive so any modification is recorded and attributable.
How to validate: Training buckets have versioning (and Object Lock where required); only the curation role can write; a prior dataset version is recoverable; access is logged centrally.
Avoid: Overwriting datasets in place with no versioning. You then cannot detect poisoning or prove which data trained a model; version and lock it.
Versioning and Object Lock on the in-account training buckets keep datasets tamper-evident and recoverable, with writes limited to the curation role.
- Turn on versioning and Object Lock (where required) on the training/validation buckets.
- Limit writes to a data-curation role via a bucket policy; deny deletes to the job role.
- Log all access to the in-account Object-Lock log bucket so modifications are attributable.
How to validate: Buckets have versioning (and Object Lock where required); writes are restricted; a previous version is recoverable; access is logged.
Avoid: Letting the training job role delete or overwrite source data. Separate curation from consumption and keep immutable versions.
Threats addressed
- Silent modification or poisoning of training data.
- No immutable record of what data trained a model.
AWS services
Pricing
Versioning and Object Lock add no per-feature charge, but you pay S3 storage for every retained version — a poisoned-then-corrected dataset keeps both copies. Use lifecycle rules to expire noncurrent versions after your retention window to control cost. See Locking objects with S3 Object Lock.
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM05 Data and Model Poisoning
NIST AI Risk Management Framework (AI 100-1)
- MANAGE.4 Risk treatments, monitoring and response are documented and applied
AWS Well-Architected Generative AI Lens (Security)
- GENSEC06-BP01 Implement data purification filters for model training workflows
Learning resources
- Using S3 Object Lock (doc)
References
- AWS SRA for AI — Capability 2, Amazon S3
AI Security Maturity Model