vmss_config: Virtual machine scaleset configuration functions

Description Usage Arguments Details Value See Also Examples

View source: R/vmss_config.R

Description

Virtual machine scaleset configuration functions

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
centos_7.5_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

centos_7.6_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

centos_8.1_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

debian_8_backports_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

debian_9_backports_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

debian_10_backports_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

debian_10_backports_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

ubuntu_dsvm_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh, nsg_rule_allow_jupyter,
  nsg_rule_allow_rstudio)), load_balancer = lb_config(rules =
  list(lb_rule_ssh, lb_rule_jupyter, lb_rule_rstudio), probes =
  list(lb_probe_ssh, lb_probe_jupyter, lb_probe_rstudio)), ...)

ubuntu_dsvm_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh, nsg_rule_allow_jupyter,
  nsg_rule_allow_rstudio)), load_balancer = lb_config(rules =
  list(lb_rule_ssh, lb_rule_jupyter, lb_rule_rstudio), probes =
  list(lb_probe_ssh, lb_probe_jupyter, lb_probe_rstudio)), ...)

windows_dsvm_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_rdp)),
  load_balancer = lb_config(rules = list(lb_rule_rdp), probes =
  list(lb_probe_rdp)), options = scaleset_options(keylogin = FALSE), ...)

rhel_7.6_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

rhel_8_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

rhel_8.1_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

rhel_8.1_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

rhel_8.2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

rhel_8.2_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

ubuntu_16.04_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

ubuntu_18.04_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

ubuntu_20.04_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

ubuntu_20.04_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_ssh)),
  load_balancer = lb_config(rules = list(lb_rule_ssh), probes =
  list(lb_probe_ssh)), ...)

windows_2016_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_rdp)),
  load_balancer = lb_config(rules = list(lb_rule_rdp), probes =
  list(lb_probe_rdp)), options = scaleset_options(keylogin = FALSE), ...)

windows_2019_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_rdp)),
  load_balancer = lb_config(rules = list(lb_rule_rdp), probes =
  list(lb_probe_rdp)), options = scaleset_options(keylogin = FALSE), ...)

windows_2019_gen2_ss(datadisks = numeric(0),
  nsg = nsg_config(list(nsg_rule_allow_rdp)),
  load_balancer = lb_config(rules = list(lb_rule_rdp), probes =
  list(lb_probe_rdp)), options = scaleset_options(keylogin = FALSE), ...)

vmss_config(image, options = scaleset_options(), datadisks = numeric(0),
  nsg = nsg_config(), vnet = vnet_config(), load_balancer = lb_config(),
  load_balancer_address = ip_config(), autoscaler = autoscaler_config(),
  other_resources = list(), variables = list(), ...)

Arguments

datadisks

The data disks to attach to the VM. Specify this as either a vector of numeric disk sizes in GB, or a list of datadisk_config objects for more control over the specification.

nsg

The network security group for the scaleset. Can be a call to nsg_config to create a new NSG; an AzureRMR resource object or resource ID to reuse an existing NSG; or NULL to not use an NSG (not recommended).

load_balancer

The load balancer for the scaleset. Can be a call to lb_config to create a new load balancer; an AzureRMR resource object or resource ID to reuse an existing load balancer; or NULL if load balancing is not required.

...

For the specific VM configurations, other customisation arguments to be passed to vm_config. For vmss_config, named arguments that will be folded into the scaleset resource definition in the template.

options

Scaleset options, as obtained via a call to scaleset_options.

image

For vmss_config, the VM image to deploy. This should be an object of class image_config, created by the function of the same name.

vnet

The virtual network for the scaleset. Can be a call to vnet_config to create a new virtual network, or an AzureRMR resource object or resource ID to reuse an existing virtual network. Note that by default, AzureVM will associate the NSG with the virtual network/subnet, not with the VM's network interface.

load_balancer_address

The public IP address for the load balancer. Can be a call to ip_config to create a new IP address, or an AzureRMR resource object or resource ID to reuse an existing address resource. Ignored if load_balancer is NULL.

autoscaler

The autoscaler for the scaleset. Can be a call to autoscaler_config to create a new autoscaler; an AzureRMR resource object or resource ID to reuse an existing autoscaler; or NULL if autoscaling is not required.

other_resources

An optional list of other resources to include in the deployment.

variables

An optional named list of variables to add to the template.

Details

These functions are for specifying the details of a new virtual machine scaleset deployment: the base VM image and related options, along with the Azure resources that the scaleset may need. These include the network security group, virtual network, load balancer and associated public IP address, and autoscaler.

Each resource can be specified in a number of ways:

The vmss_config function is the base configuration function, and the others call it to create VM scalesets with specific operating systems and other image details.

The VM scaleset configurations with gen2 in the name use generation 2 VMs, which feature several technical improvements over the earlier generation 1. Consider using these for greater efficiency, however note that gen2 VMs are only available for select images and do not support all possible VM sizes.

A VM scaleset configuration defines the following template variables by default, depending on its resources. If a particular resource is created, the corresponding *Name, *Id and *Ref variables will be available. If a resource is referred to but not created, the *Name* and *Id variables will be available. Other variables can be defined via the variables argument.

Variable name Contents Description
location [resourceGroup().location] Region to deploy resources
vmId [resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))] VM scaleset resource ID
vmRef [concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))] Scaleset template reference
nsgName [concat(parameters('vmName'), '-nsg')] Network security group resource name
nsgId [resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))] NSG resource ID
nsgRef [concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))] NSG template reference
vnetName [concat(parameters('vmName'), '-vnet')] Virtual network resource name
vnetId [resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))] Vnet resource ID
vnetRef [concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))] Vnet template reference
subnet subnet Subnet name. Only defined if a Vnet was created or supplied as an az_resource object.
subnetId [concat(variables('vnetId'), '/subnets/', variables('subnet'))] Subnet resource ID. Only defined if a Vnet was created or supplied as an az_resource object.
lbName [concat(parameters('vmName'), '-lb')] Load balancer resource name
lbId [resourceId('Microsoft.Network/loadBalancers', variables('lbName'))] Load balancer resource ID
lbRef [concat('Microsoft.Network/loadBalancers/', variables('lbName'))] Load balancer template reference
lbFrontendName frontend Load balancer frontend IP configuration name. Only defined if a load balancer was created or supplied as an az_resource object.
lbBackendName backend Load balancer backend address pool name. Only defined if a load balancer was created or supplied as an az_resource object.
lbFrontendId [concat(variables('lbId'), '/frontendIPConfigurations/', variables('lbFrontendName'))] Load balancer frontend resource ID. Only defined if a load balancer was created or supplied as an az_resource object.
lbBackendId [concat(variables('lbId'), '/backendAddressPools/', variables('lbBackendName'))] Load balancer backend resource ID. Only defined if a load balancer was created or supplied as an az_resource object.
ipName [concat(parameters('vmName'), '-ip')] Public IP address resource name
ipId [resourceId('Microsoft.Network/publicIPAddresses', variables('ipName'))] IP resource ID
ipRef [concat('Microsoft.Network/publicIPAddresses/', variables('ipName'))] IP template reference
asName [concat(parameters('vmName'), '-as')] Autoscaler resource name
asId [resourceId('Microsoft.Insights/autoscaleSettings', variables('asName'))] Autoscaler resource ID
asRef [concat('Microsoft.Insights/autoscaleSettings/', variables('asName'))] Autoscaler template reference
asMaxCapacity [mul(int(parameters('instanceCount')), 10)] Maximum capacity for the autoscaler. Only defined if an autoscaler was created.
asScaleValue [max(div(int(parameters('instanceCount')), 5), 1)] Default capacity for the autoscaler. Only defined if an autoscaler was created.

Thus, for example, if you are creating a VM scaleset named "myvmss" along with all its associated resources, the NSG is named "myvmss-nsg", the virtual network is "myvmss-vnet", the load balancer is "myvmss-lb", the public IP address is "myvmss-ip", and the autoscaler is "myvm-as".

Value

An object of S3 class vmss_config, that can be used by the create_vm_scaleset method.

See Also

scaleset_options for options relating to the scaleset resource itself

nsg_config, ip_config, vnet_config, lb_config, autoscaler_config for other resource configs

build_template for template builder methods

vm_config for configuring an individual virtual machine

create_vm_scaleset

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# basic Linux (Ubuntu) and Windows configs
ubuntu_18.04_ss()
windows_2019_ss()

# Windows DSVM scaleset, no load balancer and autoscaler
windows_dsvm_ss(load_balancer=NULL, autoscaler=NULL)

# RHEL VM exposing ports 80 (HTTP) and 443 (HTTPS)
rhel_8_ss(nsg=nsg_config(nsg_rule_allow_http, nsg_rule_allow_https))

# exposing no ports externally
rhel_8_ss(nsg=nsg_config(list()))

# low-priority (spot) VMs, large scaleset (>100 instances allowed), no managed identity
rhel_8_ss(options=scaleset_options(priority="spot", large_scaleset=TRUE, managed_identity=FALSE))


## Not run: 

# reusing existing resources: placing a scaleset in an existing vnet/subnet
# we don't need a new network security group either
vnet <- AzureRMR::get_azure_login()$
    get_subscription("sub_id")$
    get_resource_group("rgname")$
    get_resource(type="Microsoft.Network/virtualNetworks", name="myvnet")

ubuntu_18.04_ss(vnet=vnet, nsg=NULL)


## End(Not run)

AzureVM documentation built on Oct. 23, 2020, 5:20 p.m.