This guide walks you through creating a virtual machine, connecting via SSH, and managing its lifecycle.
Prerequisites
- A Raff Cloud Platform account with billing set up
- An API key
- A project ID (found in your dashboard under project settings)
- An SSH key pair (optional but recommended)
Step 1: Authenticate
Set your API key and project ID as environment variables for convenience:
export RAFF_API_KEY="YOUR_API_KEY"
export RAFF_PROJECT_ID="YOUR_PROJECT_ID"
Verify your access:
curl -H "X-API-Key: $RAFF_API_KEY" \
https://api.rafftechnologies.com/api/v1/vms
Step 2: Create a VM
Create an Ubuntu VM with 2 vCPUs, 4 GB RAM:
curl -X POST https://api.rafftechnologies.com/api/v1/vms \
-H "X-API-Key: $RAFF_API_KEY" \
-H "X-Project-ID: $RAFF_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "my-ubuntu-server",
"template_id": "<template-uuid>",
"pricing_id": 3,
"region": "us-east",
"ssh_keys": ["ssh-ed25519 AAAA... user@laptop"],
"backup_type": "weekly",
"backup_time": "8am",
"backup_date": "Saturday"
}'
Replace <template-uuid> with your OS template ID from the dashboard.
The pricing_id determines CPU, RAM, storage, and bandwidth allocation.
The response includes your new VM details:
{
"success": true,
"data": {
"id": "69590a15-9f68-4b6f-8232-b07781218852",
"name": "my-ubuntu-server",
"status": "provisioning",
"cpu": 2,
"ram": 4,
"storage": 80,
"pricing_id": 3,
"price_per_hour": "0.027764",
"billing_type": "payg",
"public_ipv4_address": "15.204.178.3",
"region": "us-east"
}
}
Step 3: Wait for VM to Become Active
Poll the VM status until it becomes active:
curl -H "X-API-Key: $RAFF_API_KEY" \
https://api.rafftechnologies.com/api/v1/vms/69590a15-9f68-4b6f-8232-b07781218852
The VM transitions through these states:
| Status | Description |
|---|
provisioning | Resources being allocated |
booting | VM is booting up |
initiating | Initial setup running |
active | Ready to use |
Step 4: Connect via SSH
Once the VM is active, connect using the public IPv4 address:
If you provided a password instead of SSH keys during creation:
ssh root@15.204.178.3
# Enter the password you set
Step 5: Manage Your VM
Stop the VM
curl -X POST -H "X-API-Key: $RAFF_API_KEY" -H "X-Project-ID: $RAFF_PROJECT_ID" \
https://api.rafftechnologies.com/api/v1/vms/69590a15-9f68-4b6f-8232-b07781218852/stop
Stopped VMs retain their resources and IP address. You are still billed for reserved resources.
Resize the VM
Resize requires the VM to be stopped first:
curl -X POST https://api.rafftechnologies.com/api/v1/vms/69590a15-9f68-4b6f-8232-b07781218852/resize \
-H "X-API-Key: $RAFF_API_KEY" \
-H "X-Project-ID: $RAFF_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{"cpu": 4, "ram": 8}'
Start the VM
curl -X POST -H "X-API-Key: $RAFF_API_KEY" -H "X-Project-ID: $RAFF_PROJECT_ID" \
https://api.rafftechnologies.com/api/v1/vms/69590a15-9f68-4b6f-8232-b07781218852/start
Delete the VM
curl -X DELETE -H "X-API-Key: $RAFF_API_KEY" -H "X-Project-ID: $RAFF_PROJECT_ID" \
https://api.rafftechnologies.com/api/v1/vms/69590a15-9f68-4b6f-8232-b07781218852
Deleting a VM is permanent. All data on the VM will be lost. Make sure to back up any important data first.
VPC Networking
Every VM is automatically placed in a VPC for private networking. You can control this behavior:
Auto-created VPC (Default)
If you don’t specify any VPC options, a new VPC is created automatically named vpc-{vm-name}.
Shared VPC
To place multiple VMs on the same private network, create the first VM (which auto-creates a VPC), then pass that vpc_id to subsequent VMs:
# Second VM joins the same VPC
curl -X POST https://api.rafftechnologies.com/api/v1/vms \
-H "X-API-Key: $RAFF_API_KEY" \
-H "X-Project-ID: $RAFF_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "my-second-vm",
"template_id": "<template-uuid>",
"pricing_id": 1,
"region": "us-east",
"vpc_id": "<vpc-uuid-from-first-vm>"
}'
Custom VPC
Create a VPC with a specific name and CIDR:
curl -X POST https://api.rafftechnologies.com/api/v1/vms \
-H "X-API-Key: $RAFF_API_KEY" \
-H "X-Project-ID: $RAFF_PROJECT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "my-vm",
"template_id": "<template-uuid>",
"pricing_id": 1,
"region": "us-east",
"vpc_name": "production-vpc",
"vpc_cidr": "10.0.1.0/24"
}'