Create a VM
Learn how to create a virtual machine using the web panel, CLI, REST API, or Terraform.
Prerequisites
- ServersCamp account with positive balance
- SSH key added to your account (see SSH Keys tutorial)
- For CLI/API: Authentication configured
Choose Your Method
Creating a VM via Web Panel
- Navigate to Compute > Virtual Machines
- Click Create VM
- Select your configuration:
- Region: Choose the datacenter closest to your users
- Image: Ubuntu 22.04, Debian 12, AlmaLinux 9, etc.
- Size: Select instance type (e.g., burst-xs for development)
- Storage: Choose disk size and class
- SSH Key: Select your uploaded key
- Enter a name for your VM
- Click Create
Your VM will be ready in about 30-60 seconds.
Creating a VM via CLI
Make sure you have the scli tool installed and configured.
Bash
# Create a basic VM
scli vm create \
--name my-server \
--image ubuntu-22.04 \
--size burst-xs \
--ssh-key my-key \
--region eu-central-1
# Create with custom storage
scli vm create \
--name production-app \
--image debian-12 \
--size standard \
--storage 100 \
--storage-class enhanced \
--ssh-key my-key \
--region eu-central-1
Available sizes: burst-xxs, burst-xs, burst-s, burst-m, burst-l, standard-light, standard, standard-plus, etc.
Run
scli vm sizes to see all available instance types and pricing.
Creating a VM via REST API
Send a POST request to the /v1/vms endpoint.
cURL
curl -X POST https://api.serverscamp.com/v1/vms \
-H "Authorization: Bearer $SCAMP_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-server",
"region": "eu-central-1",
"image": "ubuntu-22.04",
"size": "burst-xs",
"storage": {
"size_gb": 50,
"class": "standard"
},
"ssh_keys": ["my-key-id"],
"vpc_id": "vpc-abc123"
}'
Response
JSON
{
"id": "vm-xyz789",
"name": "my-server",
"status": "creating",
"region": "eu-central-1",
"image": "ubuntu-22.04",
"size": "burst-xs",
"ip_address": null,
"created_at": "2024-01-15T10:30:00Z"
}
Poll the GET /v1/vms/{id} endpoint until status changes to running.
Creating a VM via Terraform
First, configure the ServersCamp provider.
main.tf
terraform {
required_providers {
serverscamp = {
source = "serverscamp/serverscamp"
version = "~> 1.0"
}
}
}
provider "serverscamp" {
# Token from SCAMP_API_TOKEN env var
}
Define your VM resource:
vm.tf
resource "serverscamp_vm" "web" {
name = "web-server"
region = "eu-central-1"
image = "ubuntu-22.04"
size = "burst-xs"
storage {
size_gb = 50
class = "standard"
}
ssh_keys = [serverscamp_ssh_key.main.id]
vpc_id = serverscamp_vpc.main.id
tags = {
environment = "production"
app = "web"
}
}
output "vm_ip" {
value = serverscamp_vm.web.ip_address
}
Bash
terraform init
terraform plan
terraform apply