az_vmss_resource function

Virtual machine scaleset resource class

Virtual machine scaleset resource class

Class representing a virtual machine scaleset resource. In general, the methods in this class should not be called directly, nor should objects be directly instantiated from it. Use the az_vmss_template class for interacting with scalesets instead. class

Format

An R6 object of class az_vmss_resource, inheriting from AzureRMR::az_resource.

Details

A single virtual machine scaleset in Azure is actually a collection of resources, including any and all of the following.

  • Network security group (Azure resource type Microsoft.Network/networkSecurityGroups)
  • Virtual network (Azure resource type Microsoft.Network/virtualNetworks)
  • Load balancer (Azure resource type Microsoft.Network/loadBalancers)
  • Public IP address (Azure resource type Microsoft.Network/publicIPAddresses)
  • Autoscaler (Azure resource type Microsoft.Insights/autoscaleSettings)
  • The scaleset itself (Azure resource type Microsoft.Compute/virtualMachineScaleSets)

By wrapping the deployment template used to create these resources, the az_vmss_template class allows managing them all as a single entity.

Methods

The following methods are available, in addition to those provided by the AzureRMR::az_template class.

  • sync_vmss_status: Check the status of the scaleset.
  • list_instances(): Return a list of az_vm_resource objects, one for each VM instance in the scaleset. Note that if the scaleset has a load balancer attached, the number of instances will vary depending on the load.
  • get_instance(id): Return a specific VM instance in the scaleset.
  • start(id=NULL, wait=FALSE): Start the scaleset. In this and the other methods listed here, id can be an optional character vector of instance IDs; if supplied, only carry out the operation for those instances.
  • restart(id=NULL, wait=FALSE): Restart the scaleset.
  • stop(deallocate=TRUE, id=NULL, wait=FALSE): Stop the scaleset.
  • get_public_ip_address(): Get the public IP address of the scaleset (technically, of the load balancer). If the scaleset doesn't have a load balancer attached, returns NA.
  • get_vm_public_ip_addresses(id=NULL, nic=1, config=1): Get the public IP addresses for the instances in the scaleset. Returns NA for the instances that are stopped or not publicly accessible.
  • get_vm_private_ip_addresses(id=NULL, nic=1, config=1): Get the private IP addresses for the instances in the scaleset.
  • get_vnet(nic=1, config=1): Get the scaleset's virtual network resource.
  • get_nsg(nic=1, config=1): Get the scaleset's network security group resource.
  • run_deployed_command(command, parameters=NULL, script=NULL, id=NULL): Run a PowerShell command on the instances in the scaleset.
  • run_script(script, parameters=NULL, id=NULL): Run a script on the VM. For a Linux VM, this will be a shell script; for a Windows VM, a PowerShell script. Pass the script as a character vector.
  • reimage(id=NULL, datadisks=FALSE): Reimage the instances in the scaleset. If datadisks is TRUE, reimage any attached data disks as well.
  • redeploy(id=NULL): Redeploy the instances in the scaleset.
  • mapped_vm_operation(..., id=NULL): Carry out an arbitrary operation on the instances in the scaleset. See the do_operation method of the AzureRMR::az_resource class for more details.
  • add_extension(publisher, type, version, settings=list(),protected_settings=list(), key_vault_settings=list()): Add an extension to the scaleset.
  • do_vmss_operation(...) Carry out an arbitrary operation on the scaleset resource (as opposed to the instances in the scaleset).

Instance operations

AzureVM has the ability to parallelise scaleset instance operations using a background process pool provided by AzureRMR. This can lead to significant speedups when working with scalesets with high instance counts. The pool is created automatically the first time that it is required, and remains persistent for the session. You can control the size of the process pool with the azure_vm_minpoolsize and azure_vm_maxpoolsize options, which have default values 2 and 10 respectively.

The id argument lets you specify a subset of instances on which to carry out an operation. This can be a character vector of instance IDs; a list of instance objects such as returned by list_instances; or a single instance object. The default (NULL) is to carry out the operation on all instances.

See Also

AzureRMR::az_resource , get_vm_scaleset_resource , az_vmss_template , AzureRMR::init_pool

VM scaleset API reference

  • Maintainer: Hong Ooi
  • License: MIT + file LICENSE
  • Last published: 2020-10-14