The bucket was full of data. Some of it harmless. Some of it dangerous.
Masking sensitive data in AWS S3 read-only roles is not optional. It is a requirement when compliance, privacy, and security matter. S3 is often configured with permissions that allow internal or external users to read files, logs, or datasets. Without proper masking, sensitive values—PII, financial records, credentials—are exposed to anyone with access.
An AWS S3 read-only IAM role typically grants s3:GetObject privileges. This aligns with principle-of-least-privilege, but it does not solve the problem of data sensitivity. Users can still view the raw content of any object. The real solution is applying a masking layer between the read action and the data delivery.
Amazon offers several ways to integrate masking at scale. One approach is to process objects through AWS Lambda, triggered by an S3 GET request via a presigned URL or API Gateway. The Lambda function can read the file, identify sensitive fields, and replace them with masked values before returning data to the requester. Another approach is to use Amazon Macie for detection and classification, then store masked versions in a parallel bucket for distribution to read-only roles.