GetBucketPolicyStatus
Note
This operation is not supported by directory buckets.
Retrieves the policy status for an Amazon S3 bucket, indicating whether the bucket is public.
In order to use this operation, you must have the s3:GetBucketPolicyStatus
permission. For more information about Amazon S3 permissions, see Specifying Permissions in a
Policy.
For more information about when Amazon S3 considers a bucket public, see The Meaning of "Public".
The following operations are related to GetBucketPolicyStatus
:
Request Syntax
GET /?policyStatus HTTP/1.1
Host: Bucket
.s3.amazonaws.com
x-amz-expected-bucket-owner: ExpectedBucketOwner
URI Request Parameters
The request uses the following URI parameters.
- Bucket
-
The name of the Amazon S3 bucket whose policy status you want to retrieve.
Required: Yes
- x-amz-expected-bucket-owner
-
The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<PolicyStatus>
<IsPublic>boolean</IsPublic>
</PolicyStatus>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in XML format by the service.
- PolicyStatus
-
Root level tag for the PolicyStatus parameters.
Required: Yes
- IsPublic
-
The policy status for this bucket.
TRUE
indicates that this bucket is public.FALSE
indicates that the bucket is not public.Type: Boolean
Examples
Sample Request
The following request gets a bucket policy status.
GET /<bucket-name>?policyStatus HTTP/1.1 Host: <bucket-name>.s3.<Region>.amazonaws.com x-amz-date: <Thu, 15 Nov 2016 00:17:21 GMT> Authorization: <signatureValue>
Sample Response
This example illustrates one usage of GetBucketPolicyStatus.
HTTP/1.1 200 OK x-amz-id-2: ITnGT1y4REXAMPLEPi4hklTXouTf0hccUjo0iCPEXAMPLEutBj3M7fPGlWO2SEWp x-amz-request-id: 51991EXAMPLE5321 Date: Thu, 15 Nov 2016 00:17:22 GMT Server: AmazonS3 Content-Length: 0 <PolicyStatus> <IsPublic>TRUE</IsPublic> </PolicyStatus>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: