Creates an instance resource in the specified project using the data included in the request.
gce_vm_create(name, predefined_type = "f1-micro", image_project = "debian-cloud", image_family = "debian-8", cpus = NULL, memory = NULL, image = "", disk_source = NULL, network = "default", externalIP = NULL, canIpForward = NULL, description = NULL, metadata = NULL, scheduling = NULL, serviceAccounts = NULL, tags = NULL, auth_email = "GCE_AUTH_FILE", project = gce_get_global_project(), zone = gce_get_global_zone(), dry_run = FALSE, disk_size_gb = NULL, use_beta = FALSE, acceleratorCount = NULL, acceleratorType = "nvidia-tesla-k80")
The name of the resource, provided by the client when initially creating the resource
A predefined machine type from gce_list_machinetype
Project ID of where the image lies
Name of the image family to search for
If not defining
If not defining
Name of the image resource to return
Specifies a valid URL to an existing Persistent Disk resource.
The name of the network interface
An external IP you have previously reserved, leave NULL to have one assigned or
Allows this instance to send and receive packets with non-matching destination or source IPs
An optional description of this resource
A named list of metadata key/value pairs assigned to this instance
Scheduling options for this instance, such as preemptible instances
A list of service accounts, with their specified scopes, authorized for this instance
A list of tags to apply to this instance
If it includes '@' then assume the email, otherwise an environment file var that includes the email
Project ID for this request
The name of the zone for this request
whether to just create the request JSON
If not NULL, override default size of the boot disk (size in GB)
If set to TRUE will use the beta version of the API. Should not be used for production purposes.
A zone operation, or if the name already exists the VM object from gce_get_instance
Authentication scopes used by this function are:
cpus must be in multiples of 2 up to 32
memory must be in multiples of 256
image_family must be supplied
To create an instance you need to specify:
Project [if not default]
Zone [if not default]
Machine type - either a predefined type or custom CPU and memory
Network - usually default, specifies open ports etc.
Image - a source image containing the operating system
You can add metadata to the server such as
shutdown-script. Details available here: https://cloud.google.com/compute/docs/storing-retrieving-metadata
If you want to not have an external IP then modify the instance afterwards
You can set preemptible VMs by passing this in the
scheduling = list(preemptible = TRUE)
This creates a VM that may be shut down prematurely by Google - you will need to sort out how to save state if that happens in a shutdown script etc. However, these are much cheaper.