Skip to main content

dtctl virtual-machine create

Usage​

dtctl virtual-machine create [flags]

Aliases​

c

Description​

Create one or more virtual machines. At minimum, provide a name, a flavor (dtctl flavor list), at least one block device (--volume) that boots from an image, and at least one network interface (--network). For access, provide either an --ssh-key-name or a --script.

Example​

# Create a VM from an image, on a network, with an SSH key
dtctl virtual-machine create --name web-1 --flavor-id <flavor-id> \
--volume uuid=<image-id>,source_type=image,device_type=disk,volume_size=10,delete_on_termination=true \
--network uuid=<network-id>,primary_ip=auto,port_security_enabled=true \
--ssh-key-name my-key

Flags​

OptionDescription
--countNumber of identical VMs to create in one call (1-50)
Default: 1
--enable-hot-plugEnable CPU/RAM hot-plug on the VM
Default: false
--flavor-id, -fFlavor ID for size (vCPU/RAM); see 'dtctl flavor list' (required)
--gpu-imageMark the selected image as a GPU image
Default: false
--name, -nName of the virtual machine (required)
--network, -iNetwork interface as key=value (repeatable). Keys: uuid, primary_ip (or 'auto'), secondary_ips, security_groups (ids), port_security_enabled. Example: uuid=<network-id>,primary_ip=auto,port_security_enabled=true (required)
--script, -sProvisioning script as key=value: os (linux|windows), username, password, hostname, disable_root. Provide this or --ssh-key-name
--security-groups, -gComma-separated security group names to attach to the VM
--ssh-key-name, -kSSH key name to inject (see 'dtctl ssh list'). Provide this or --script
--user-data, -uCloud-init user data to run on first boot
--volume, -vBlock device mapping as key=value (repeatable). Keys: uuid, source_type (image|volume|blank), device_type (disk|cdrom), destination_type (volume|local), volume_size, volume_type, delete_on_termination. Example: uuid=<image-id>,source_type=image,device_type=disk,volume_size=10,delete_on_termination=true (required)
CommandDescription
dtctl virtual-machine listList virtual machines
dtctl virtual-machine showShow a virtual machine
dtctl virtual-machine update-nameRename a virtual machine
dtctl virtual-machine update-networkUpdate a network interface
dtctl virtual-machine deleteDelete a virtual machine
dtctl virtual-machine actionPerform a power/lifecycle action
dtctl virtual-machine attach-networkAttach a network interface
dtctl virtual-machine attach-new-volumeCreate and attach a new volume
dtctl virtual-machine attach-volumeAttach an existing volume
dtctl virtual-machine consoleGet a VM's remote console URL
dtctl virtual-machine detach-networkDetach a network interface
dtctl virtual-machine detach-volumeDetach a volume
dtctl virtual-machine historyShow a VM's action history
dtctl virtual-machine history-detailsShow one history entry
dtctl virtual-machine hot-plugEnable or disable hot-plug
dtctl virtual-machine networksList a VM's network interfaces
dtctl virtual-machine volumesList a VM's attached volumes

Global Flags​

OptionDescription
--api-urlSend this command to a different API endpoint, e.g. a test environment (default "https://console.dt.net.tr/api/v1")
--config, -cSpecify a custom config file
Default: ~/.config/dtctl/config.yaml
--no-headersOmit the column headers, for scripting
Default: false
--output, -oOutput format: text, wide, vertical, json. text fits the terminal, wide never truncates, vertical prints one field per line
Default: text