Adding an ACL to a bucket by using an ACL request body example

Here’s a sample PUT request that uses an ACL request body to add an ACL to the finance bucket and, at the same time, change the owner of the bucket. The ACL grants read and write access to the bucket to user lgreen and changes the bucket owner to user mwhite. The ACL request body is in a file named acl-7.xml.

Request body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
     <Owner>
          <ID>b9d39144-a081-4760-b0e8-b8fb51e10192</ID>
          <DisplayName>mwhite</DisplayName>
     </Owner>
     <AccessControlList>
          <Grant>
               <Grantee xsi:type="CanonicalUser" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID>
                    <DisplayName>lgreen</DisplayName>
               </Grantee>
               <Permission>READ</Permission>
          </Grant>
          <Grant>
               <Grantee xsi:type="CanonicalUser" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
               <ID>b9d39144-a081-4762-b0e8-b8fb51e10192</ID>
               <DisplayName>lgreen</DisplayName>
          </Grantee>
          <Permission>WRITE</Permission>
          </Grant>
      </AccessControlList>
</AccessControlPolicy>

Request with s3curl command line


./s3curl.pl --id=lgreen --put acl-7.xml -- -k
     "https://europe.hcp.example.com/finance?acl"

Request headers

PUT /finance?acl HTTP/1.1
Host: europe.hcp.example.com
Date: Wed, 20 Mar 2013 16:03:02 +0000
Authorization: AWS bGdyZWVu:mVNu4YolbdvK+PVzmafhOvd1VgU=
Content-Length: 727

Response headers

HTTP/1.1 200 OK
Date: Wed, 20 Mar 2013 16:03:02 GMT
Server: HCP V7.0.0.16
Content-Length: 0

Trademarks and Legal Disclaimer

© 2017 Hitachi Data Systems Corporation. All rights reserved.