Ansible aws_s3 module: PutObjectAcl error in PUT operation


If you have noticed this error, it’s not a bug but a permission error when using the aws_s3 module:

Ansible aws_s3 module: PutObjectAcl error in PUT operation

We encountered this while using the PUT operation the module in a playbook with:

  • Ansible v3.6.9
  • pip3 9.0.1
  • botocore 1.26.10
  • boto3 1.23.10

And we hit this error:

INFO:AnsibleMonitor:Ansible host failed reason Unable to set object ACL: An error occurred (AccessControlListNotSupported) when calling the PutObjectAcl operation: The bucket does not allow ACLs


So, why the ACL error when we have ACL is disabled in the target S3 bucket?

Well this GitHub post explains it well, also this.

Long story short, use the open ‘permission’ statement to get rid of this, example below:

- name: Export to S3
region: region-name
bucket: bucket-name
object: my-file.txt
src: /var/tmp/my-file.txt
overwrite: true
mode: put
validate_certs: no
permission: []


This permission statement is crucial for this operation to complete.

Leave a Comment

Your email address will not be published. Required fields are marked *