Accessing s3 Using IAM Role in a Gitlab Runner (helm chart)

I’m trying to use an s3 bucket in a Gitlab runner. This is an rke2 cluster and the runner pod is running on an Ec2 instance. The Ec2 instance assumes the role and with the Ec2 instance I am able to list the contents of the bucket.

In the pods container, I am using python boto3 client. When trying to upload a file, It raises a NoCredentialError exception.

I have configured both ServiceAccountAnnotations and PodAnnotations in the Helm chart (iam.amazonaws.com/role-arn: <my_role_arn>).

Not sure if the problem is in the configuration of the Helm chart and/or configuration of boto3 credential file (originally, I didn’t think one was needed).