Configuring a GPG AWS S3 read-only role is the fastest way to share encrypted data without risking unwanted writes or deletes. It lets you grant trusted users or systems secure access to files in S3, while keeping every object immutable from their perspective.
Why use GPG with AWS S3 read-only roles
When dealing with sensitive files, S3’s role-based access control is not enough on its own. GPG encryption protects data at rest and in transit, ensuring even if your S3 read-only IAM role credentials leak, the data inside remains unreadable without the right key. Combine GPG encryption with a tightly scoped AWS IAM role that grants only s3:GetObject permissions to a specific bucket or prefix.
How to set up an AWS S3 read-only IAM role
- In the AWS console, create a new IAM role with trusted entities matching your environment (AWS services or external accounts).
- Attach a custom policy that allows:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [ "s3:GetObject"],
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}
- Do not include write actions like
PutObjectorDeleteObject. Keep the trust and permission scopes minimal. - Assume the role with AWS CLI or SDK when pulling data.
Encrypting and decrypting with GPG
Before uploading files to S3, encrypt them locally with: