Bucket names

Cloud Storage buckets must follow a few general naming conventions in order to be considered valid. These names must adhere to the following:

  • Be between 3 and 63 characters in length (unless using domain naming)
  • Only contain lowercase letters, numbers, dashes, underscores, and periods
  • Begin and end with a number or letter
  • Not contain anything similar to the reserved word google

Given these constraints, a resulting regular expression for validating bucket names may look something like the following:

/^[a-z0-9][a-z0-9_-]{1,61}[a-z0-9]$/

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.