Bucket metadata

Get metadata

Get bucket size

This page discusses the metadata fields that are stored along with buckets in Cloud Storage.

Introduction

Cloud Storage buckets have metadata associated with them. Metadata identifies properties of the bucket and specifies how the bucket should be handled when it's accessed.

Metadata is stored as key: value pairs, where the value can take a variety of forms, including strings, arrays, or even nested key:value pairs. For example, the bucket name is a string, while a bucket Object Lifecycle Management configuration is an array of rules in which each rule contains several child key: value pairs.

The mutability of metadata varies:

  • Some you can only view.

  • Some you can only set when the bucket is first created, and cannot edit or remove.

  • Some you can add and edit, but not remove.

  • Some you can add, edit, and remove at any time.

Non-editable metadata

The following metadata is set during bucket creation, and cannot be edited or removed:

  • Bucket name

  • Bucket location

  • The project the bucket is a part of

  • Generation number

    • A bucket's generation number uniquely identifies the version of the bucket even if more than one version of a bucket share the same name.

    • A bucket's generation value never changes.

    • There is no guarantee that generation numbers increase for successive versions, only that each new version has a unique generation number.

    • There is no relationship between generation numbers of unrelated buckets.

  • Metageneration number

    • A bucket's metageneration number uniquely identifies the metadata state of the bucket. The metageneration number is 1 at the time of bucket creation and increases each time you modify the bucket's metadata.

Editable metadata

Editable bucket metadata is metadata whose values you can typically modify at any time. In some cases, such as the bucket being subject to an organization policy constraint, there are restrictions on modifying certain metadata values.

1 This metadata cannot be viewed or managed using the XML API.

2 You can use the XML API to set this metadata during bucket creation, but not to view or manage this metadata.

What's next