This page outlines the naming guidelines you should follow when creating buckets and uploading objects in Cloud Storage. To learn how to create a bucket, see the Creating storage buckets guide.
Bucket name requirements
Your bucket names must meet the following requirements:
- Bucket names must contain only lowercase letters, numbers, dashes (
-), underscores (
_), and dots (
.). Names containing dots require verification.
- Bucket names must start and end with a number or letter.
- Bucket names must contain 3 to 63 characters. Names containing dots can contain up to 222 characters, but each dot-separated component can be no longer than 63 characters.
- Bucket names cannot be represented as an IP address in dotted-decimal notation (for example, 192.168.5.4).
- Bucket names cannot begin with the "goog" prefix.
- Bucket names cannot contain "google" or close misspellings, such as "g00gle".
Also, for DNS compliance and future compatibility, you should not use underscores
_) or have a period adjacent to another period or dash. For example, ".." or "-." or
".-" are not valid in DNS names.
Bucket name considerations
Bucket names reside in a single Cloud Storage namespace. This means that:
- Every bucket name must be unique.
- Bucket names are publicly visible.
If you try to create a bucket with a name that already belongs to an existing bucket, Cloud Storage responds with an error message. However, once you delete a bucket, you or another user can reuse its name for a new bucket.
A bucket name can only be assigned during creation; you cannot change the name of an existing bucket. Instead, you should create a new bucket with the desired name and move the contents from the old bucket to the new bucket. See Moving and Renaming Buckets for a step-by-step guide.
See also the Naming Best Practices section, which includes recommendations about excluding proprietary information from bucket and object names.
Object name requirements
Your object names must meet the following requirements:
- Object names can contain any sequence of valid Unicode characters, of length 1-1024 bytes when UTF-8 encoded.
- Object names cannot contain Carriage Return or Line Feed characters.
- Object names cannot start with
- Objects cannot be named
For more information about Carriage Return and Line Feed characters, see Newline.
It is strongly recommended that you avoid the following in your object names:
- Avoid using control characters that are illegal in XML 1.0 (#x7F–#x84 and #x86–#x9F): these characters will cause XML listing issues when you try to list your objects.
- Avoid using "#" in your object names: gsutil interprets object names ending with #<numeric string> as version identifiers, so including "#" in object names can make it difficult or impossible to perform operations on such versioned objects using gsutil (see Object Versioning and Concurrency Control).
- Avoid using "[", "]", "*", or "?" in your object names: gsutil interprets these characters as wildcards, so including them in object names can make it difficult or impossible to perform wildcard operations using gsutil.
Object name considerations
Object names reside in a flat namespace within a bucket. This means that:
- Different buckets can have objects with the same name.
- Objects do not reside within subdirectories in a bucket.
For example, you can name an object
/europe/france/paris.jpg to make it
paris.jpg resides in the subdirectory
/europe/france, but to
Cloud Storage, the object simply exists in the bucket and has the name
As with buckets, existing objects cannot be directly renamed. Instead, you can copy an object, give the copied version the desired name, and delete the original version of the object. See Renaming an object for a step-by-step guide, which includes instructions for tools like gsutil and the Google Cloud Platform Console, which handle the renaming process automatically.