Overview

  1. Create a network
  2. Generate an SSH keypair
  3. Deploy a VM
  4. Associate a public IP
  5. Access the VM via SSH

List Available Templates

Templates define the base OS image your VM will use.

cmk list templates templatefilter=all filter=id,name

Example output:

id                                   name
-----------------------------------  ------------------------------
b9d4cf39-88dc-4092-b972-9114d315bdc0 Ubuntu 24.04

List Network Offerings

Network offerings define connectivity features like NAT, DHCP, and firewall.

cmk list networkofferings filter=id,name,guestiptype,traffictype

Choose:

DefaultIsolatedNetworkOfferingWithSourceNatService

Create a Network

Create your isolated network.
This triggers deployment of a Virtual Router (VR) that provides NAT, DHCP, and DNS.

cmk create network   name=myisolatednet   displaytext="My Isolated Network"   networkofferingid=<network_offering_id>   zoneid=<zone_id>

Create an SSH Keypair

This keypair will allow secure access to your VM.

cmk create sshkeypair name=mykeypair | jq -r '.keypair.privatekey' | sed 's/\\n/\n/g' > ~/mykeypair.pem
chmod 600 ~/mykeypair.pem

Deploy the Virtual Machine

Deploy a VM using your template, network, and keypair.

cmk deploy virtualmachine   zoneid=<zone_id>   serviceofferingid=<service_offering_id>   templateid=<template_id>   networkids=<network_id>   keypair=mykeypair   name=ubuntu-keyed   displayname="Ubuntu 24.04 with Keypair"

Associate a Public IP

Allocate a public IP address to your isolated network.

cmk associate ipaddress networkid=<network_id>

This public IP will be attached to your VR (Virtual Router).


Create a Port Forwarding Rule

Forward incoming traffic on port 22 (SSH) to your VM.

cmk create portforwardingrule   ipaddressid=<public_ip_id>   privateport=22   publicport=22   protocol=tcp   virtualmachineid=<vm_id>

SSH Into Your VM

Now you can connect to your VM securely.

ssh -i ~/mykeypair.pem ubuntu@<public_ip>

Summary

StepActionCommand
1List templateslist templates
2List offeringslist networkofferings
3Create networkcreate network ...
4Create keypaircreate sshkeypair ...
5Deploy VMdeploy virtualmachine ...
6Associate IPassociate ipaddress ...
7Port forwardcreate portforwardingrule ...
8SSH loginssh -i mykeypair.pem ubuntu@<ip>