This page outlines the naming guidelines you should follow when uploading objects in Cloud Storage. To learn how to upload an object, see the Uploading objects guide.
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 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, including instructions for tools like gsutil and the Google Cloud Console, which handle the renaming process automatically.
See also the Naming Best Practices section, which includes recommendations about excluding proprietary information from object names.