The bucket held secrets no one should change, only read. That was the rule. And the lock was not a password, but a signed token that expired before it could be stolen.
AWS S3 read-only roles with JWT-based authentication give you precision access and airtight security without managing static credentials. You grant a role that can only perform GetObject and list operations, then you tie that role to a trust policy that accepts temporary credentials exchanged via a verified JSON Web Token. This turns your S3 bucket into a controlled resource—open to the right users, closed to everyone else.
First, define the least-privilege IAM policy. It should allow s3:GetObject and optional s3:ListBucket only for the targeted bucket and its objects. No PutObject, no DeleteObject. The access boundary lives in IAM, not in code.
Next, create an IAM role with a trust policy that uses an identity provider. This can be Amazon Cognito, AWS IAM Identity Center, or an external IdP that supports OIDC. The trust policy must match the JWT issuer, audience, and subject claims. AWS will only issue temporary credentials if the token is valid and signed.