Naming resources

This page describes the naming convention for Compute Engine resources.

Resources are the fundamental components that make up a Cloud service or product. For example, resources on Compute Engine include but are not limited to:

To learn more about resources, see Global, regional, and zonal resources documentation.

Naming convention

When you create a new resource on Compute Engine, you have to provide properties such as a name for the resource.

For resources on Compute Engine, the resource name must meet the following format (unless specified differently in the documentation for creating that resource):

  • Be 1-63 characters in length.
  • Comply with RFC 1035 conventions.
  • Match the regular expression ^[a-z]([-a-z0-9]*[a-z0-9])?. This means that the first character must be a lowercase letter, and all the following characters must be hyphens, lowercase letters, or digits, except the last character, which cannot be a hyphen.

Name uniqueness

In general, resource names must be unique within a location within a project. For example, an external IP address name must be unique within the region where it resides. However, you can reuse names across locations.

If the vmDnsSetting setting for the Compute Engine project resource isn't set to ZonalOnly then all VM names must be unique across the project. We strongly recommend using the vmDnsSetting:ZonalOnly setting for your projects, not only so you can reuse VM names across zones and regions, but also because it offers higher reliability by isolating failures in the DNS registration to individual zones. For more information, see Zonal DNS names.