Example 2: Adding an ACL to an object by using an ACL request body

Here’s a sample PUT request that uses an ACL request body to add an ACL to the object named mktg/budget_proposals/BudgProp-2020. The ACL grants read access to all authenticated users and full control user pblack. It makes no change to the object owner. The ACL request body is in a file named acl-3.xml.

Request body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
     <AccessControlList>
          <Grant>
               <Grantee xsi:type="Group"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <URI>http://acs.amazonaws.com/groups/global/AuthenticatedUsers</URI>
               </Grantee>
               <Permission>READ</Permission>
          </Grant>
          <Grant>
               <Grantee xsi:type="CanonicalUser"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <ID>b9d39144-a081-4761-b0e8-b8fb51e10192</ID>
                    <DisplayName>pblack</DisplayName>
               </Grantee>
               <Permission>FULL_CONTROL</Permission>
          </Grant>
     </AccessControlList>
</AccessControlPolicy>

Request with s3curl command line

./s3curl.pl --id=lgreen --put=acl-3.xml -- -k
     "https://finance.europe.hcp.example.com/mktg/budget_proposals/
     BudgProp-2020?acl"

Request headers

PUT /mktg/budget_proposals/BudgProp-2020?acl HTTP/1.1
Host: finance.europe.hcp.example.com
Date: Fri, 07 February 2020 17:19:26 +0000
Authorization: AWS bGdyZWVu:mRqVstjwWxvfEFr8JajjrPcd8eY=
Content-Length: 632

Response headers

HTTP/1.1 200 OK
Date: Fri, 07 February 2020 17:19:26 GMT
Content-Length: 0

© 2015, 2020 Hitachi Vantara LLC. All rights reserved.