Locking Down Log Storage Buckets
Apply policies and Object Lock to make logs immutable.
Locking Down Log Storage Buckets is a free AWS Security Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Bucket Is the Crown Jewel
CloudTrail, Config, and Flow Logs ultimately store data in S3 buckets. That bucket is the crown jewel of your audit trail, so it deserves the strongest protections. If the bucket is secure, an attacker who compromises a workload still cannot reach the evidence of what they did.
Block Public Access
The first control is S3 Block Public Access, ensuring the log bucket is never exposed to the internet. A publicly readable log bucket leaks sensitive operational detail to anyone. Enabling Block Public Access at the account and bucket level closes this risk decisively.
Restrictive Bucket Policy
A tight bucket policy should allow only the logging service to write and only specific security roles to read, denying everyone else. You can also deny s3:DeleteObject for all principals so logs cannot be removed through normal API calls, a strong baseline against casual tampering.
{
"Effect": "Deny",
"Principal": "*",
"Action": "s3:DeleteObject",
"Resource": "arn:aws:s3:::my-log-bucket/*"
}S3 Object Lock
S3 Object Lock enforces write-once-read-many (WORM) storage, making objects truly immutable for a set period. Even an account administrator cannot delete or overwrite a locked object before its retention expires. This is the strongest defense against an attacker, or insider, deleting logs.
Compliance vs Governance Mode
Object Lock has two modes. In Governance mode, users with special permission can override the lock. In Compliance mode, no one, not even the root user, can delete or shorten retention until it expires. For regulated audit logs, Compliance mode provides the strongest guarantee.
Versioning
Object Lock requires versioning, which keeps every version of an object. Versioning alone also helps: if an attacker overwrites an object, the previous version remains. Combined with a deny on DeleteObjectVersion, versioning makes destroying history far harder than deleting a single current object.
MFA Delete
MFA Delete requires multi-factor authentication to permanently delete object versions or change versioning state. It adds a human, hardware-backed gate in front of destructive actions on the log bucket, so even a compromised credential cannot quietly purge versions without the MFA device.
Encryption of Logs
Encrypt log data at rest with KMS, ideally a customer managed key whose policy limits who can decrypt. This protects confidentiality, since logs often contain sensitive details like usernames and IPs. KMS also produces an audit record of every decrypt, adding visibility into who reads the logs.
Access Logging and Monitoring
Enable S3 server access logging or use CloudTrail data events on the log bucket so you can see who accessed it. Alarm on unexpected reads or any delete attempt. Monitoring the log bucket itself ensures that an attack on your evidence is, ironically, also recorded.
Layering the Controls
No single setting is enough. Block Public Access, a deny-delete bucket policy, Object Lock in Compliance mode, versioning, MFA Delete, and KMS encryption together make the bucket resistant to deletion, modification, and exposure. Defense in depth is the goal: each layer covers another's gaps.
Bringing It Together
A properly locked-down log bucket is immutable, private, encrypted, and monitored. Combined with CloudTrail log file validation for tamper detection, it ensures your evidence both survives and stays provably intact. This bucket-level hardening is exactly what exam scenarios about protecting logs expect.
Quick Check
Test your bucket-hardening knowledge.
Recap
Harden log buckets with layered controls: Block Public Access, a deny-delete bucket policy, S3 Object Lock (Compliance mode is unbreakable, Governance is overridable), versioning, MFA Delete, and KMS encryption for confidentiality. Monitor access with S3 access logging or CloudTrail data events. Together they make logs immutable, private, and monitored.
Frequently asked questions
Is the “Locking Down Log Storage Buckets” lesson free?
Yes — the full text of “Locking Down Log Storage Buckets” is free to read here on the web, and the AWS Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Locking Down Log Storage Buckets”?
Apply policies and Object Lock to make logs immutable. You practise AWS Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Security Academy?
No prior experience is required. AWS Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Locking Down Log Storage Buckets” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Security Academy lesson?
Yes. Every AWS Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Why Log Tampering Is a Threat
- CloudTrail Log File Validation
- Locking Down Log Storage Buckets
- Centralized Log Archive Accounts