All Products
Search
Document Center

Object Storage Service:PutBucketPolicy

Last Updated:Apr 29, 2024

You can call PutBucketPolicy to configure policies for a specified bucket.

Request syntax

PUT /? policy
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 13 Nov 2018 09:09:13 GMT
Authorization: OSS qn6q**************:77Dv****************
Policy written in JSON

Examples

  • Sample requests

    PUT /? policy
    Content-Length: 230
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Thu, 21 Feb 2019 12:51:09 GMT
    Authorization: OSS qn6q**************:77Dv****************
    {
       "Version":"1",
       "Statement":[
       {
         "Action":[
           "oss:PutObject",
           "oss:GetObject"
        ],
        "Effect":"Deny",
        "Principal":["1234567890"],
        "Resource":["acs:oss:*:1234567890:*/*"]
       }
      ]
     }
  • Sample responses

    HTTP/1.1 200 OK
    content-length: 0
    server: AliyunOSS
    x-oss-server-time: 87
    connection: keep-alive
    x-oss-request-id: 5C6E9EBD5CC26B28EE41****
    date: Thu, 21 Feb 2019 12:51:09 GMT