GCLOUD_COMPUTE_INSTANCE-TEMPLATES_CREATE(1)

NAME

gcloud compute instance-templates create - create a Compute Engine virtual machine instance template

SYNOPSIS

gcloud compute instance-templates create NAME [--no-boot-disk-auto-delete] [--boot-disk-device-name=BOOT_DISK_DEVICE_NAME] [--boot-disk-size=BOOT_DISK_SIZE] [--boot-disk-type=BOOT_DISK_TYPE] [--can-ip-forward] [--custom-cpu=CUSTOM_CPU] [--custom-memory=CUSTOM_MEMORY] [--description=DESCRIPTION] [--disk=[auto-delete=AUTO-DELETE],[boot=BOOT],[device-name=DEVICE-NAME],[mode=MODE],[name=NAME]] [--image-project=IMAGE_PROJECT] [--local-ssd=[device-name=DEVICE-NAME],[interface=INTERFACE]] [--machine-type=MACHINE_TYPE] [--maintenance-policy=MAINTENANCE_POLICY] [--metadata=KEY=VALUE,[KEY=VALUE,...]] [--metadata-from-file=KEY=LOCAL_FILE_PATH,[KEY=LOCAL_FILE_PATH,...]] [--network=NETWORK] [--preemptible] [--region=REGION] [--no-restart-on-failure] [--subnet=SUBNET] [--tags=TAG,[TAG,...]] [--address=ADDRESS | --no-address] [--image=IMAGE | --image-family=IMAGE_FAMILY] [--no-scopes | --scopes=[SCOPE,...]] [--no-service-account | --service-account=SERVICE_ACCOUNT] [GLOBAL-FLAG ...]

DESCRIPTION
gcloud compute instance-templates create facilitates the creation of Google Compute Engine virtual machine instance templates. For example, running:
    $ gcloud compute instance-templates create INSTANCE-TEMPLATE
will create one instance templates called 'INSTANCE-TEMPLATE'. Instance templates are global resources, and can be used to create instances in any zone.

POSITIONAL ARGUMENTS

    NAME
        The name of the instance template.

FLAGS

    --boot-disk-auto-delete
        Automatically delete boot disks when their instances are deleted. Enabled by default, use --no-boot-disk-auto-delete to disable.

    --boot-disk-device-name=BOOT_DISK_DEVICE_NAME
        The name the guest operating system will see for the boot disk as. This option can only be specified if a new boot disk is being created (as opposed to mounting an existing persistent disk).

    --boot-disk-size=BOOT_DISK_SIZE
        The size of the boot disk. This option can only be specified if a new boot disk is being created (as opposed to mounting an existing persistent disk). The value must be a whole number followed by a size unit of KB for kilobyte, MB for megabyte, GB for gigabyte, or TB for terabyte. For example, 10GB will produce a 10 gigabyte disk. The minimum size a boot disk can have is 10 GB. Disk size must be a multiple of 1 GB.

    --boot-disk-type=BOOT_DISK_TYPE
        The type of the boot disk. This option can only be specified if a new boot disk is being created (as opposed to mounting an existing persistent disk). To get a list of available disk types, run $ gcloud compute disk-types list.

    --can-ip-forward
        If provided, allows the instances to send and receive packets with non-matching destination or source IP addresses.

    --custom-cpu=CUSTOM_CPU
        A whole number value indicating how many cores are desired in the custom machine type. Both --custom-cpu and --custom-memory must be specified if a custom machine type is desired, and the --machine-type flag must be omitted.

    --custom-memory=CUSTOM_MEMORY
        A whole number value indicating how much memory is desired in the custom machine type. A size unit should be provided (eg. 3072MiB or 9GiB) - if no units are specified, GiB is assumed. Both --custom-cpu and --custom-memory must be specified if a custom machine type is desired, and the --machine-type flag must be omitted.

    --description=DESCRIPTION
        Specifies a textual description for the instance template.

    --disk=[auto-delete=AUTO-DELETE],[boot=BOOT],[device-name=DEVICE-NAME],[mode=MODE],[name=NAME]
        Attaches persistent disks to the instances. The disks specified must already exist.

        name
            The disk to attach to the instances. When creating more than one instance and using this property, the only valid mode for attaching the disk is read-only (see mode below).

        mode
            Specifies the mode of the disk. Supported options are ro for read-only and rw for read-write. If omitted, rw is used as a default. It is an error for mode to be rw when creating more than one instance because read-write disks can only be attached to a single instance.

        boot
            If yes, indicates that this is a boot disk. The virtual machines will use the first partition of the disk for their root file systems. The default value for this is no.

        device-name
            An optional name that indicates the disk name the guest operating system will see. If omitted, a device name of the form persistent-disk-N will be used.

        auto-delete
            If yes, this persistent disk will be automatically deleted when the instance is deleted. However, if the disk is later detached from the instance, this option won't apply. The default value for this is no.

    --image-project=IMAGE_PROJECT
        The project against which all image and image family references will be resolved. See --image for more details.

    --local-ssd=[device-name=DEVICE-NAME],[interface=INTERFACE]
        Attaches a local SSD to the instances. This flag is currently in BETA and may change without notice.

        device-name
            Optional. A name that indicates the disk name the guest operating system will see. If omitted, a device name of the form local-ssd-N will be used.

        interface
            Optional. The kind of disk interface exposed to the VM for this SSD. Valid values are SCSI and NVME. SCSI is the default and is supported by more guest operating systems. NVME may provide higher performance.

    --machine-type=MACHINE_TYPE
        Specifies the machine type used for the instances. To get a list of available machine types, run 'gcloud compute machine-types list'. If unspecified, the default type is n1-standard-1.

    --maintenance-policy=MAINTENANCE_POLICY
        Specifies the behavior of the instances when their host machines undergo maintenance. The default is MIGRATE. MAINTENANCE_POLICY must be one of:

        MIGRATE
            The instances should be migrated to a new host. This will temporarily impact the performance of instances during a migration event.

        TERMINATE
            The instances should be terminated.

    --metadata=KEY=VALUE,[KEY=VALUE,...]
        Metadata to be made available to the guest operating system running on the instances. Each metadata entry is a key/value pair separated by an equals sign. Metadata keys must be unique and less than 128 bytes in length. Values must be less than or equal to 32,768 bytes in length. Multiple arguments can be passed to this flag, e.g., --metadata key-1=value-1,key-2=value-2,key-3=value-3. In images that have Compute Engine tools installed on them, such as the official images (https://cloud.google.com/compute/docs/images), the following metadata keys have special meanings:

        startup-script
            Specifies a script that will be executed by the instances once they start running. For convenience, --metadata-from-file can be used to pull the value from a file.

        startup-script-url
            Same as startup-script except that the script contents are pulled from a publicly-accessible location on the web.

    --metadata-from-file=KEY=LOCAL_FILE_PATH,[KEY=LOCAL_FILE_PATH,...]
        Same as --metadata except that the value for the entry will be read from a local file. This is useful for values that are too large such as startup-script contents.

    --network=NETWORK
        Specifies the network that the instances will be part of. If --subnet is also specified subnet must be a subnetwork of network specified by --network. If neither is specified, this defaults to the "default" network.

    --preemptible
        If provided, instances will be preemptible and time-limited. Instances may be preempted to free up resources for standard VM instances, and will only be able to run for a limited amount of time. Preemptible instances can not be restarted and will not migrate.

    --region=REGION
        The region of the subnetwork to attach. If not specified, you will be prompted to select a region. To avoid prompting when this flag is omitted, you can set the compute/region property:
        $ gcloud config set compute/region REGION
    A list of regions can be fetched by running:
        $ gcloud compute regions list
    To unset the property, run:
        $ gcloud config unset compute/region
    Alternatively, the region can be stored in the environment variable CLOUDSDK_COMPUTE_REGION.

    --restart-on-failure
        The instances will be restarted if they are terminated by Compute Engine. This does not affect terminations performed by the user. Enabled by default, use --no-restart-on-failure to disable.

    --subnet=SUBNET
        Specifies the subnet that the instances will be part of. If --network is also specified subnet must be a subnetwork of network specified by --network.

    --tags=TAG,[TAG,...]
        Specifies a list of tags to apply to the instances for identifying the instances to which network firewall rules will apply. See gcloud compute firewall-rules create(1) for more details.

At most one of these may be specified:

    --address=ADDRESS
        Assigns the given external IP address to the instance that is created. This option can only be used when creating a single instance.

    --no-address
        If provided, the instances will not be assigned external IP addresses.

At most one of these may be specified:

    --image=IMAGE
        Specifies the boot image for the instances. For each instance, a new boot disk will be created from the given image. Each boot disk will have the same name as the instance. To view a list of public images and projects, run $ gcloud compute images list. When using this option, --boot-disk-device-name and --boot-disk-size can be used to override the boot disk's device name and size, respectively.

    --image-family=IMAGE_FAMILY
        The family of the image that the boot disk will be initialized with. When a family is specified instead of an image, the latest non-deprecated image associated with that family is used. By default, debian-8 is assumed for this flag.

At most one of these may be specified:

    --no-scopes
        Create instance without scopes

    --scopes=[SCOPE,...]
        If not provided, the instance will be assigned the default scopes, described below. SCOPE can be either the full URI of the scope or an alias. Available aliases are:
        default
          Scopes assigned to instances by default:
          - https://www.googleapis.com/auth/cloud.useraccounts.readonly
          - https://www.googleapis.com/auth/devstorage.read_only
          - https://www.googleapis.com/auth/logging.write
          - https://www.googleapis.com/auth/monitoring.write
          - https://www.googleapis.com/auth/service.management.readonly
          - https://www.googleapis.com/auth/servicecontrol
        bigquery
          - https://www.googleapis.com/auth/bigquery
        cloud-platform
          - https://www.googleapis.com/auth/cloud-platform
        compute-ro
          - https://www.googleapis.com/auth/compute.readonly
        compute-rw
          - https://www.googleapis.com/auth/compute
        datastore
          - https://www.googleapis.com/auth/datastore
        logging-write
          - https://www.googleapis.com/auth/logging.write
        monitoring
          - https://www.googleapis.com/auth/monitoring
        monitoring-write
          - https://www.googleapis.com/auth/monitoring.write
        service-control
          - https://www.googleapis.com/auth/servicecontrol
        service-management
          - https://www.googleapis.com/auth/service.management.readonly
        sql
          - https://www.googleapis.com/auth/sqlservice
        sql-admin
          - https://www.googleapis.com/auth/sqlservice.admin
        storage-full
          - https://www.googleapis.com/auth/devstorage.full_control
        storage-ro
          - https://www.googleapis.com/auth/devstorage.read_only
        storage-rw
          - https://www.googleapis.com/auth/devstorage.read_write
        taskqueue
          - https://www.googleapis.com/auth/taskqueue
        useraccounts-ro
          - https://www.googleapis.com/auth/cloud.useraccounts.readonly
        useraccounts-rw
          - https://www.googleapis.com/auth/cloud.useraccounts
        userinfo-email
          - https://www.googleapis.com/auth/userinfo.email

At most one of these may be specified:

    --no-service-account
        Create instance without service account

    --service-account=SERVICE_ACCOUNT
        A service account is an identity attached to the instance. Its access tokens can be accessed through the instance metadata server and are used to authenticate applications on the instance. The account can be either an email address or an alias corresponding to a service account. You can explicitly specify the Compute Engine default service account using the 'default' alias. If not provided, the instance will get project's default service account.

GLOBAL FLAGS
Run $ gcloud help for a description of flags available to all commands.