Prism Element v2.0: Cloud-init VM Customisation

June 7, 2022

by Chris Rasmussen

Intended Audience Level: Beginner/Intro

Code Sample Type: Snippet

Nutanix Technologies: Prism Element

Minimum Product Version: 5.16

Script/Code Language: JSON Payload

REST API Sample? Yes

REST API Version: v2.0

This code sample is a JSON payload designed for use with API test and development applications such as Postman or with custom scripts written by the user. Please note the use of {{variables}} through this code sample – they must be replaced with data relevant for your environment.

Code Sample Details

Note this section may be empty, if additional code sample details are not available.

JSON payload to create a VM using the Nutanix Prism Element v2.0 APIs. Please make sure you replace all {{variable}} instances with values appropriate for your environment and the ssh-rsa key with an SSH public key valid for your virtual machines.

    "name": "{{vm_name}}",
    "memory_mb": 4096,
    "num_vcpus": 2,
    "description": "",
    "num_cores_per_vcpu": 1,
    "timezone": "UTC",
    "boot": {
        "uefi_boot": false,
        "boot_device_order": [
    "vm_disks": [
            "is_cdrom": false,
            "disk_address": {
                "device_bus": "scsi"
            "vm_disk_clone": {
                "disk_address": {
                    "vmdisk_uuid": "{{cloud_init_image_uuid}}"
                "minimum_size": 10737418240
    "vm_nics": [
            "network_uuid": "{{subnet_uuid}}",
            "is_connected": true
    "hypervisor_type": "ACROPOLIS",
    "vm_customization_config": {
        "userdata": "#cloud-config\nusers:\n  - name: nutanix\n    ssh-authorized-keys:\n      - ssh-rsa KEY\n    sudo: ['ALL=(ALL) NOPASSWD:ALL']\n    groups: sudo\n    shell: /bin/bash",
        "files_to_inject_list": []
    "vm_features": {
        "AGENT_VM": false