Machine-to-machine communication with AWS S3 is straightforward until you need strict control. Read-only roles remove risk from unwanted write or delete actions, letting systems exchange data cleanly. A proper S3 read-only IAM policy is the foundation for secure automation, data pipelines, analytics jobs, and CI/CD processes.
Start with IAM. Create a role specifically for machine use. Attach an inline policy that allows only s3:GetObject and, if needed, s3:ListBucket. Deny all write permissions—no PutObject, no DeleteObject. Scope the policy to the exact bucket and prefixes machines need. This enforces the principle of least privilege.
Trust policy configuration comes next. Use the AssumeRole mechanism so machines use temporary credentials. This prevents long-lived secrets from lingering in configs. For cross-account access, list the allowed AWS account IDs or service principals in the trust document. Every machine knows where it can connect and where it cannot.