AWS Builder Center
Securing S3 Buckets: Common Mistakes and How to Avoid Them

Securing S3 Buckets: Common Mistakes and How to Avoid Them

The most common S3 misconfigurations that lead to data leaks, and how to fix them.

Series: AWS Security 30 Days, 30 Articles Challenge (31 articles)

  1. …
  2. 9
    Securing S3 Buckets: Common Mistakes and How to Avoid Them This article
Welcome to Day 8 of the 30 Days AWS Security Challenge. We're kicking off week two, moving from identity into data and network protection. There is no better place to start than S3, since misconfigured buckets are one of the most common causes of real world AWS data leaks, and most of the fixes take just a few minutes.

Why S3 Shows Up in So Many Breach Headlines

S3 is simple to use, which is exactly why it is easy to misconfigure. A bucket can be created and made public in a couple of clicks, and if that bucket happens to hold customer data, logs, or backups, an accidental public setting can expose everything to anyone on the internet who finds the URL. This has happened to major companies more than once, not because S3 itself is insecure, but because of settings left wrong on the customer side. Remember the Shared Responsibility Model from Day 1: this is squarely your side of the line.

Mistake One: Buckets Left Publicly Accessible

This is the big one. A bucket set to public means anyone with the URL can list or download its contents. Sometimes this is intentional, like hosting static website assets. Often it is accidental, left over from testing or copied from a tutorial without changing the settings.
The fix is AWS's Block Public Access setting, which you can apply at the account level or per bucket. Go to S3 > your bucket > Permissions > Block Public Access, and unless you have a specific, deliberate reason for public access, turn every option here on. As a starting habit, enable Block Public Access at the account level so no future bucket can be made public by accident.

Mistake Two: Overly Broad Bucket Policies

Even without full public access, a bucket policy can grant more access than intended. A common error is writing a policy with a wildcard resource or principal that ends up granting access to far more than planned.
Always write bucket policies with the most specific resource and principal you can. Instead of granting access to  "Principal": "*" , specify exact account IDs or role ARNs that actually need access. Review policies the same way we broke down IAM policies on Day 4, one statement at a time, and ask what the broadest possible interpretation of each rule would allow.

Mistake Three: No Encryption on Sensitive Data

Storing sensitive data in S3 without encryption means anyone who does gain access, through a misconfiguration or a compromised credential, gets that data in plain, readable form. S3 supports encryption at rest by default now for new buckets, but it is worth explicitly confirming for older buckets, especially ones holding customer or financial data.
Check this under S3 > your bucket > Properties > Default encryption. We will go deeper into encryption specifically on Day 9 and Day 10.

Mistake Four: No Logging or Visibility

If a bucket is accessed or modified in a way you did not expect, you want to know about it. Without logging enabled, you have no trail to investigate after the fact. Enable S3 Server Access Logging or, better, make sure CloudTrail is capturing data events for your buckets, which we will cover in more depth on Day 14.

Mistake Five: Overly Permissive IAM Access to S3

Sometimes the bucket itself is locked down correctly, but an IAM policy attached to a user or role grants  s3:*  across all buckets. This defeats careful bucket level security if the identity accessing it has far more access than the task requires.
Apply the same principle of least privilege here that we discussed with IAM policies. Grant access to specific actions, on specific buckets, rather than defaulting to broad wildcard access because it is faster to set up.

A Quick Self Check

If you want to audit your own buckets right now, open S3 > your bucket list, and look at the "Access" column AWS shows next to each bucket. Anything flagged as public deserves an immediate look, even if you believe it is intentional.

Key Takeaways

  • Public S3 buckets are the single most common source of AWS data leaks, and Block Public Access closes most of that risk in minutes
  • Write bucket policies with specific principals and resources instead of broad wildcards
  • Confirm encryption is enabled on any bucket holding sensitive data
  • Turn on logging so you have a trail if something unexpected happens
  • Apply least privilege to IAM access, not just to the bucket policy itself
Tomorrow we dig deeper into encryption specifically, starting with AWS Key Management Service and how it handles the keys behind the scenes.

Series: AWS Security 30 Days, 30 Articles Challenge (31 articles)

  1. …
  2. 9
    Securing S3 Buckets: Common Mistakes and How to Avoid Them This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article