All Products
Search
Document Center

Object Storage Service:GetBucketInfo

Last Updated:Apr 29, 2024

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 permissions to query information about a bucket. If you want to query information about a bucket by using a RAM user or the access credentials provided by 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 HTTP headers.

Response headers

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

Response elements

Element

Type

Example

Description

BucketInfo

Container

N/A

The container that stores information about the bucket.

Child nodes: Bucket

Parent nodes: none

Bucket

Container

N/A

The container that stores information about the bucket.

Parent nodes: BucketInfo

CreationDate

Time

2013-07-31T10:56:21.000Z

The time when the bucket was created. The time is in UTC.

Parent nodes: BucketInfo.Bucket

ExtranetEndpoint

String

oss-cn-hangzhou.aliyuncs.com

The public endpoint that is used to access the bucket over the Internet.

Parent nodes: BucketInfo.Bucket

IntranetEndpoint

String

oss-cn-hangzhou-internal.aliyuncs.com

The 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

Location

String

oss-cn-hangzhou

The region in which the bucket is located.

Parent nodes: BucketInfo.Bucket

StorageClass

String

Standard

The storage class of the bucket.

Valid values: Standard, IA, Archive, and ColdArchive.

For more information about storage classes, see Overview.

Name

String

oss-example

The name of the bucket.

Parent nodes: BucketInfo.Bucket

ResourceGroupId

String

rg-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

Owner

Container

N/A

The container that stores information about the bucket owner.

Parent nodes: BucketInfo.Bucket

ID

String

27183473914****

The ID of the bucket owner.

Parent nodes: BucketInfo.Bucket.Owner

DisplayName

String

username

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

Parent nodes: BucketInfo.Bucket.Owner

AccessControlList

Container

N/A

The container that stores the access control list (ACL) about the bucket.

For more information about how to configure the ACL for a bucket, see Bucket ACLs.

Parent nodes: BucketInfo.Bucket

Grant

Enumerated string

private

The ACL of the bucket.

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

Parent nodes: BucketInfo.Bucket.AccessControlList

DataRedundancyType

Enumerated string

LRS

The redundancy type of the bucket.

Valid values: LRS and ZRS.

Parent nodes: BucketInfo.Bucket

Versioning

String

Enabled

The versioning state of the bucket.

Valid values: Enabled and Suspended.

For more information about versioning states, see PutBucketVersioning.

Parent nodes: BucketInfo.Bucket

ServerSideEncryptionRule

Container

N/A

The container that stores the server-side encryption method of the bucket.

For more information, see Server-side encryption.

Parent nodes: BucketInfo.Bucket

ApplyServerSideEncryptionByDefault

Container

N/A

The container that stores the default server-side encryption method.

Parent nodes: BucketInfo.Bucket

SSEAlgorithm

String

KMS

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

Valid values: KMS and AES256.

Parent nodes: BucketInfo.Bucket

KMSMasterKeyID

String

******

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, no value is returned.

Parent nodes: BucketInfo.Bucket

CrossRegionReplication

String

Disabled

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

Valid values: Enabled and Disabled.

Parent nodes: BucketInfo.Bucket

TransferAcceleration

String

Disabled

Indicates whether transfer acceleration is enabled for the bucket.

Valid values: Enabled and Disabled.

Parent nodes: BucketInfo.Bucket

HierarchicalNamespace

String

Enabled

Indicates whether hierarchical namespace is enabled for the bucket.

Valid value: Enabled.

Parent nodes: BucketInfo.Bucket

AccessMonitor

String

Enabled

Indicates whether access tracking is enabled for the bucket.

Valid values: Enabled and Disabled.

Parent nodes: BucketInfo.Bucket

BucketPolicy

Container

N/A

The container that stores the logs.

Parent nodes: BucketInfo.Bucket

LogBucket

String

examplebucket

The name of the bucket that stores the logs.

LogPrefix

String

log/

The directory in which logs are stored.

BlockPublicAccess

Boolean

true

Indicates whether Block Public Access is enabled for the bucket.

  • true: Block Public Access is enabled.

  • false: Block Public Access is disabled.

Examples

Sample request

Get /?bucketInfo HTTP/1.1
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com  
Date: Sat, 12 Sep 2015 07:51:28 GMT
Authorization: OSS qn6q**************:77Dv****************                

Sample success response

  • Sample success response when information about the bucket is queried

    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 response when the 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>
      <EC>0015-00000101</EC>
    </Error>
  • Sample error response when you do not have the 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>

OSS SDKs

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

Error codes

Error code

HTTP status code

Description

NoSuchBucket

404

The bucket does not exist.

AccessDenied

403

You do not have the permissions to query information about the bucket. Only the bucket owner can query information about the bucket.