This article describes the usage of our API and how one could go about creating servers with API requests rather than using our Control Panel. All of the examples can also be found from API Documentation.

There are three ways to create a server in UpCloud’s IaaS service:

  • from a template
  • by cloning another server
  • by installing the OS from scratch using an installation media

Creating a Server From a Template

The POST request’s body should contain the necessary details of the virtual machine and at least the OS-storage. Here we clone the public Debian template which is available to all of our users.

POST /1.1/server
{
	"server" : {
		"zone" : "fi-hel1",
		"title" : "My Debian server",
		"hostname" : "debian.example.com",
		"core_number" : "4",
		"memory_amount" : "8192",
		"storage_devices" : {
			"storage_device" : [
				{
					"action" : "clone",
					"storage" : "UUID-of-template-storage",
					"title" : "Debian from a template"
				}
			]
		}
	}
}

You can get the list of template storage UUIDs with

GET /1.1/storage/template

Cloning a Server

Comparing to the previous method, here we just change the UUID of the storage device to another storage under the same UpCloud account. You can clone any storage that you own.

POST /1.1/server
{
	"server" : {
		"zone" : "fi-hel1",
		"title" : "Another Debian server",
		"hostname" : "debian2.example.com",
		"core_number" : "4",
		"memory_amount" : "8192",
		"storage_devices" : {
			"storage_device" : [
			{
				"action" : "clone",
				"storage" : "UUID-of-storage-to-clone",
				"title" : "Storage for another Debian server"
			}
			]
		}
	}
}

Creating Server from Installation Media

In addition to public templates, we also offer installation media of various operating systems. For example, Arch, Fedora and Knoppix are only available as CDROMs that you can use to install the OS yourself (and create a template if you wish).

POST /1.1/server
{
	"server" : {
		"zone" : "fi-hel1",
		"title" : "My Debian server",
		"hostname" : "debian.example.com",
		"core_number" : "4",
		"memory_amount" : "8192",
		"storage_devices" : {
			"storage_device" : [
			{
				"action" : "create",
				"size" : "20",
				"title" : "Debian from scratch"
			}
			{
				"action" : "attach",
				"storage" : "UUID-of-CDROM",
				"type" : "cdrom"
				},
				]
			}
		}
	}

You can get the list of CDROM UUIDs with

GET /1.1/storage/cdrom