Contents

VMware Aria Automation | Options for CPU|Memory values

How to Allocate CPU and Memory for VMs Using T-Shirt Sizes or Custom Values


“Always deliver more than expected.” - Larry Page (Co-founder of Google)


VMware Aria Automation | VM | CPU and Memory

Recently, I was asked how to create new VMs using T-Shirt sizes and also have the flexibility to specify custom CPU and Memory values. Typically, in the YAML code of a Aria Automation Design Template, you use either the properties cpuCount and totalMemoryMB or the flavor property. You cannot use both within the same template for the same VM.

After considering the options, I decided to use the cpuCount and totalMemoryMB properties to specify VM CPU and memory, adding logic to the YAML code to determine values based on an input named Flavor.

Flavor Options:

  • Small: 1 CPU, 2 GB memory
  • Medium: 2 CPUs, 4 GB memory
  • Large: 4 CPUs, 8 GB memory
  • Other: Use CPU and Memory values specified in custom inputs CPU and Memory. See the Full Design Template YAML code below.

These two lines of YAML code demonstrate how to specify the cpuCount and totalMemoryMB properties. This is the key to enabling both T-Shirt sizes and custom values:


Click arrow to expand the code:

1
2
cpuCount: "${(input.Flavor == 'small') ? 1 : (input.Flavor == 'medium') ? 2 : (input.Flavor == 'large') ? 4 : (input.Flavor == 'other') ? input.CPU : 1}"
totalMemoryMB: "${(input.Flavor == 'small') ? 2048 : (input.Flavor == 'medium') ? 4096 : (input.Flavor == 'large') ? 8192 : (input.Flavor == 'other') ? input.Memory * 1024 : 1024}"

Design Templates within Aria Automation:

/aria-automation-cpu-memory-values/t-shirt-01.png
Click to see Larger Image of Screen Shot

Design Template and YAML Code:

/aria-automation-cpu-memory-values/t-shirt-02.png
Click to see Larger Image of Screen Shot

Small Flavor Selected:

/aria-automation-cpu-memory-values/t-shirt-03.png
Click to see Larger Image of Screen Shot

Other Flavor Selected:

/aria-automation-cpu-memory-values/t-shirt-04.png
Click to see Larger Image of Screen Shot

Design Template Example YAML Code:

This full Design Template YAML code shows the inputs and how to specify the cpuCount and totalMemoryMB properties.

Click arrow to expand the code:

 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
formatVersion: 1
inputs:
  CustomizationSpec:
    type: string
    description: Customization Specification
    default: Customization-Ubuntu-22
    title: CustomizationSpec
  VMName:
    type: string
    title: VM Name
    minLength: 1
    maxLength: 15
    default: RCKY-9-000
  IP:
    type: string
    default: 192.168.69.17
  Flavor:
    type: string
    title: Standard Size
    default: medium
    enum:
      - small
      - medium
      - large
      - other
  Memory:
    type: number
    title: Memory(GB)
    default: 1
    minimum: 1
    maximum: 512
  CPU:
    type: number
    title: CPU Count
    default: 1
    minimum: 1
    maximum: 32
resources:
  Cloud_vSphere_Network_1:
    type: Cloud.vSphere.Network
    properties:
      networkType: existing
      constraints:
        - tag: Network:vCenter-VMs
  Cloud_vSphere_Machine_1:
    type: Cloud.vSphere.Machine
    properties:
      name: ${input.VMName}
      image: vCenter-Rocky-9
      cpuCount: "${(input.Flavor == 'small') ? 1 : (input.Flavor == 'medium') ? 2 : (input.Flavor == 'large') ? 4 : (input.Flavor == 'other') ? input.CPU : 1}"
      totalMemoryMB: "${(input.Flavor == 'small') ? 2048 : (input.Flavor == 'medium') ? 4096 : (input.Flavor == 'large') ? 8192 : (input.Flavor == 'other') ? input.Memory * 1024 : 1024}"
      networks:
        - network: ${resource.Cloud_vSphere_Network_1.id}
          assignment: static
          address: ${input.IP}

Flavors:

In my lab, I already had some Flavor Mappings defined. To allow for larger sizes, I had to create a new Flavor Mapping for the maximum sizes I wanted to support. I couldn’t specify CPU or memory sizes higher than the largest existing Flavor Mapping.


Warning I received while testing:

/aria-automation-cpu-memory-values/t-shirt-05.png
Click to see Larger Image of Screen Shot

Flavor Mappings within Aria Automation:

/aria-automation-cpu-memory-values/t-shirt-06.png
Click to see Larger Image of Screen Shot

Flavor Mapping to allow large VM Builds:

/aria-automation-cpu-memory-values/t-shirt-07.png
Click to see Larger Image of Screen Shot

Summary:

I hope this helps anyone looking to standardize new VM builds using T-Shirt sizes while also providing the flexibility to specify custom CPU and Memory values.


Aria Automation Version used for Blog Post:

VMware Aria Automation 8.17.0 was used for this Blog Post. When new versions of VMware Aria Automation are released, the code or process may need to be changed.


Info
In my blogs, I often emphasize that there are multiple methods to achieve the same objective. This article presents just one of the many ways you can tackle this task. I’ve shared what I believe to be an effective approach for this particular use case, but keep in mind that every organization and environment varies. There’s no definitive right or wrong way to accomplish the tasks discussed in this article.

  • If you found this blog article helpful and it assisted you, consider buying me a coffee to kickstart my day.