gce_vm {googleComputeEngineR} | R Documentation |
Create or fetch a virtual machine
Description
Pass in the instance name to fetch its object, or create the instance via gce_vm_create.
Usage
gce_vm(name, ..., project = gce_get_global_project(),
zone = gce_get_global_zone(), open_webports = TRUE)
Arguments
name |
The name of the instance |
... |
Arguments passed on to
|
project |
Project ID for this request |
zone |
The name of the zone for this request |
open_webports |
If TRUE, will open firewall ports 80 and 443 if not open already |
Details
Will get or create the instance as specified. Will wait for instance to be created if necessary.
Make sure the instance is big enough to handle what you need,
for instance the default f1-micro
will hang the instance when trying to install large R libraries.
Value
A gce_instance
object
Creation logic
You need these parameters defined to call the right function for creation. Check the function definitions for more details.
If the VM name exists but is not running, it start the VM and return the VM object
If the VM is running, it will return the VM object
If you specify the argument template
it will call gce_vm_template
If you specify one of file
or cloud_init
it will call gce_vm_container
Otherwise it will call gce_vm_create
Examples
## Not run:
library(googleComputeEngineR)
## auto auth, project and zone pre-set
## list your VMs in the project/zone
the_list <- gce_list_instances()
## start an existing instance
vm <- gce_vm("markdev")
## for rstudio, you also need to specify a username and password to login
vm <- gce_vm(template = "rstudio",
name = "rstudio-server",
username = "mark", password = "mark1234")
## specify your own cloud-init file and pass it into gce_vm_container()
vm <- gce_vm(cloud_init = "example.yml",
name = "test-container",
predefined_type = "f1-micro")
## specify disk size at creation
vm <- gce_vm('my-image3', disk_size_gb = 20)
## End(Not run)