The bucket lay open, its contents exposed to anyone with the wrong set of permissions. In AWS S3, this is how data leaks start — not with a big breach, but with a subtle gap in policy enforcement.
To lock down read-only roles in AWS S3, you must control IAM policies with precision. A read-only role should give users the ability to list and get objects, but nothing else. The foundation is the s3:GetObject and s3:ListBucket actions. Every other action — especially s3:PutObject, s3:DeleteObject, and bucket policy edits — must be denied explicitly. A strict least-privilege approach avoids accidental write access.
Here is a minimal policy for an S3 read-only role:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
]
}
]
}
Attach this policy to an IAM role instead of a user. Use temporary credentials via AWS STS to reduce long-term exposure. Review trust policies to ensure only approved principals can assume the role.