Queries information about a bucket.

Usage notes

  • You can initiate a GetBucketInfo request from any Object Storage Service (OSS) endpoint.
  • By default, an Alibaba Cloud account has the permission to query information about a bucket. To query information about a bucket by using a RAM user or Security Token Service (STS), you must have the oss:GetBucketInfo permission. For more information, see Attach a custom policy to a RAM user.

Request syntax

GET /?bucketInfo HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Request headers

This request contains only common request headers. For more information, see Common request headers.

Response headers

This request contains only common response headers. For more information, see Common response headers.

Response elements

ElementTypeExampleDescription
BucketInfoContainerN/AThe container that stores the bucket information.

Child nodes: Bucket

Parent nodes: none

BucketContainerN/AThe container that stores the bucket information.

Parent nodes: BucketInfo

CreationDateTime2013-07-31T10:56:21.000ZThe time when the bucket is created. The time is in UTC.

Parent nodes: BucketInfo.Bucket

ExtranetEndpointStringoss-cn-hangzhou.aliyuncs.comThe public endpoint that is used to access the bucket over the Internet.

Parent nodes: BucketInfo.Bucket

IntranetEndpointStringoss-cn-hangzhou-internal.aliyuncs.comThe internal endpoint that is used to access the bucket from Elastic Compute Service (ECS) instances that reside in the same region as the bucket.

Parent nodes: BucketInfo.Bucket

LocationStringoss-cn-hangzhouThe region in which the bucket is located.

Parent nodes: BucketInfo.Bucket

StorageClassStringStandardThe storage class of the bucket.

Valid values: Standard, IA, Archive, and ColdArchive

For more information about storage classes, see Overview.

NameStringoss-exampleThe name of the bucket.

Parent nodes: BucketInfo.Bucket

ResourceGroupIdStringrg-aek27tc********The ID of the resource group to which the bucket belongs.

If the bucket belongs to the default resource group, the resource group ID is rg-default-id.

Parent nodes: BucketInfo.Bucket

OwnerContainerN/AThe container that stores the information about the bucket owner.

Parent nodes: BucketInfo.Bucket

IDString27183473914****The user ID of the bucket owner.

Parent nodes: BucketInfo.Bucket.Owner

DisplayNameStringusernameThe name of the bucket owner, which is the same as the user ID of the bucket owner.

Parent nodes: BucketInfo.Bucket.Owner

AccessControlListContainerN/AThe container that stores the access control list (ACL) information about the bucket.

For more information about bucket ACLs, see Bucket ACL.

Parent nodes: BucketInfo.Bucket

GrantEnumerated stringprivateThe ACL of the bucket.

Valid values: private, public-read, and public-read-write

Parent nodes: BucketInfo.Bucket.AccessControlList

DataRedundancyTypeEnumerated stringLRSThe disaster recovery type of the bucket.

Valid values: LRS and ZRS

Parent nodes: BucketInfo.Bucket

VersioningStringEnabledIndicates whether versioning is enabled for the bucket.

Valid values: Enabled and Suspended

For more information about versioning, see PutBucketVersioning.

Parent nodes: BucketInfo.Bucket

ServerSideEncryptionRuleContainerN/AThe container that stores the server-side encryption method.

For more information about server-side encryption, see Server-side encryption.

Parent nodes: BucketInfo.Bucket

ApplyServerSideEncryptionByDefaultContainerN/AThe container that stores the server-side encryption method that is used by default.

Parent nodes: BucketInfo.Bucket

SSEAlgorithmStringKMSThe server-side encryption method that is used by default.

Valid values: KMS and AES256

Parent nodes: BucketInfo.Bucket

KMSMasterKeyIDString******The customer master key (CMK) ID in use. A valid value is returned only if you set SSEAlgorithm to KMS and specify the CMK ID. In other cases, an empty value is returned.

Parent nodes: BucketInfo.Bucket

CrossRegionReplicationStringDisabledIndicates whether cross-region replication (CRR) is enabled for the bucket.

Valid values: Enabled and Disabled

Parent nodes: BucketInfo.Bucket

TransferAccelerationStringDisabledIndicates whether transfer acceleration is enabled for the bucket.

Valid values: Enabled and Disabled

Parent nodes: BucketInfo.Bucket

HierarchicalNamespaceStringEnabledIndicates whether hierarchical namespace is enabled for the bucket.

Valid value: Enabled

Parent nodes: BucketInfo.Bucket

AccessMonitorStringEnabledIndicates whether access tracking is enabled for the bucket.

Valid values: Enabled and Disabled

Parent nodes: BucketInfo.Bucket

BucketPolicyContainerN/AThe container that stores the logs.

Parent nodes: BucketInfo.Bucket

LogBucketStringexamplebucketThe name of the bucket that stores the logs.
LogPrefixStringlog/The directory in which logs are stored.

Examples

Sample requests

Get /?bucketInfo HTTP/1.1
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com  
Date: Sat, 12 Sep 2015 07:51:28 GMT
Authorization: OSS qn6qrrqxo2oawuk53otf****: BuG4rRK+zNhH1AcF51NNHD39****                
Sample responses
  • Sample success responses when the information about the specified bucket is obtained<x id="1" type="exclude" text="codeblock id=&quot;codeblock_vow_acp_88d&quot; props=&quot;china&quot;>HTTP/1.1 200x-oss-request-id: 534B371674E88A4D8906****Date: Sat, 12 Sep 2015 07:51:28 GMTConnection: keep-aliveContent-Length: 531 Server: AliyunOSS&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;BucketInfo&gt; &lt;Bucket&gt; &lt;AccessMonitor&gt;Enabled&lt;/AccessMonitor&gt; &lt;CreationDate&gt;2013-07-31T10:56:21.000Z&lt;/CreationDate&gt; &lt;ExtranetEndpoint&gt;oss-cn-hangzhou.aliyuncs.com&lt;/ExtranetEndpoint&gt; &lt;IntranetEndpoint&gt;oss-cn-hangzhou-internal.aliyuncs.com&lt;/IntranetEndpoint&gt; &lt;Location&gt;oss-cn-hangzhou&lt;/Location&gt; &lt;StorageClass&gt;Standard&lt;/StorageClass&gt; &lt;TransferAcceleration&gt;Disabled&lt;/TransferAcceleration&gt; &lt;CrossRegionReplication&gt;Disabled&lt;/CrossRegionReplication&gt; &lt;Name&gt;oss-example&lt;/Name&gt; &lt;ResourceGroupId&gt;rg-aek27tc********&lt;/ResourceGroupId&gt; &lt;Owner&gt; &lt;DisplayName&gt;username&lt;/DisplayName&gt; &lt;ID&gt;27183473914****&lt;/ID&gt; &lt;/Owner&gt; &lt;AccessControlList&gt; &lt;Grant&gt;private&lt;/Grant&gt; &lt;/AccessControlList&gt; &lt;Comment&gt;test&lt;/Comment&gt; &lt;BucketPolicy&gt; &lt;LogBucket&gt;examplebucket&lt;/LogBucket&gt; &lt;LogPrefix&gt;log/&lt;/LogPrefix&gt; &lt;/BucketPolicy&gt; &lt;/Bucket&gt;&lt;/BucketInfo&gt;</codeblock"/>
    HTTP/1.1 200
    x-oss-request-id: 534B371674E88A4D8906****
    Date: Sat, 12 Sep 2015 07:51:28 GMT
    Connection: keep-alive
    Content-Length: 531  
    Server: AliyunOSS
    <?xml version="1.0" encoding="UTF-8"?>
    <BucketInfo>
      <Bucket>
        <CreationDate>2013-07-31T10:56:21.000Z</CreationDate>
        <ExtranetEndpoint>oss-cn-hangzhou.aliyuncs.com</ExtranetEndpoint>
        <IntranetEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</IntranetEndpoint>
        <Location>oss-cn-hangzhou</Location>
        <StorageClass>Standard</StorageClass>
        <TransferAcceleration>Disabled</TransferAcceleration>
        <CrossRegionReplication>Disabled</CrossRegionReplication>
        <HierarchicalNamespace>Enabled</HierarchicalNamespace>
        <Name>oss-example</Name>
        <ResourceGroupId>rg-aek27tc********</ResourceGroupId>
        <Owner>
          <DisplayName>username</DisplayName>
          <ID>27183473914****</ID>
        </Owner>
        <AccessControlList>
          <Grant>private</Grant>
        </AccessControlList>  
        <Comment>test</Comment>
        <BucketPolicy>
          <LogBucket>examplebucket</LogBucket>
          <LogPrefix>log/</LogPrefix>
        </BucketPolicy>
      </Bucket>
    </BucketInfo>
  • Sample error responses when the specified bucket does not exist
    HTTP/1.1 404 
    x-oss-request-id: 534B371674E88A4D8906****
    Date: Sat, 12 Sep 2015 07:51:28 GMT
    Connection: keep-alive
    Content-Length: 308  
    Server: AliyunOSS
    <?xml version="1.0" encoding="UTF-8"?>
    <Error>
      <Code>NoSuchBucket</Code>
      <Message>The specified bucket does not exist.</Message>
      <RequestId>568D547F31243C673BA1****</RequestId>
      <HostId>nosuchbucket.oss.aliyuncs.com</HostId>
      <BucketName>nosuchbucket</BucketName>
    </Error>
  • Sample error responses when you do not have permissions to access the bucket
    HTTP/1.1 403
    x-oss-request-id: 534B371674E88A4D8906****
    Date: Sat, 12 Sep 2015 07:51:28 GMT
    Connection: keep-alive
    Content-Length: 209  
    Server: AliyunOSS
    <?xml version="1.0" encoding="UTF-8"?>
    <Error>
      <Code>AccessDenied</Code>
      <Message>AccessDenied</Message>
      <RequestId>568D5566F2D0F89F5C0E****</RequestId>
      <HostId>test.oss.aliyuncs.com</HostId>
    </Error>

SDK

You can use OSS SDKs for the following programming languages to call the GetBucketInfo operation:

Error codes

Error codeHTTP status codeDescription
NoSuchBucket404The error message returned because the bucket does not exist.
AccessDenied403The error message returned because you do not have permissions to query the information about the bucket. Only the bucket owner can query the information about the bucket.