Introduction to UpCloud REST API

Post date: Sep 23, 2019 5:26:34 PM

______________________________________________________________________________________

List Available Plans

Cost is minimized by selecting a pre-configured plan with fixed number of CPU cores, memory size, and disk size.  Additional virtual disks and network interfaces can be added.  Custom plans with freely configured CPU core count, memory size and disk size will cost more.

List the available plans:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/plan

HTTP/1.1 200 OK

Date: Tue, 06 Aug 2019 08:29:44 GMT

Server: Apache

Content-Length: 2453

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "plans" : {

      "plan" : [

         {

            "core_number" : 1,

            "memory_amount" : 1024,

            "name" : "1xCPU-1GB",

            "public_traffic_out" : 1024,

            "storage_size" : 25,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 1,

            "memory_amount" : 2048,

            "name" : "1xCPU-2GB",

            "public_traffic_out" : 2048,

            "storage_size" : 50,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 2,

            "memory_amount" : 4096,

            "name" : "2xCPU-4GB",

            "public_traffic_out" : 4096,

            "storage_size" : 80,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 4,

            "memory_amount" : 8192,

               "name" : "4xCPU-8GB",

            "public_traffic_out" : 5120,

            "storage_size" : 160,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 6,

            "memory_amount" : 16384,

            "name" : "6xCPU-16GB",

            "public_traffic_out" : 6144,

            "storage_size" : 320,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 8,

            "memory_amount" : 32768,

            "name" : "8xCPU-32GB",

            "public_traffic_out" : 7168,

            "storage_size" : 640,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 12,

            "memory_amount" : 49152,

            "name" : "12xCPU-48GB",

            "public_traffic_out" : 9216,

            "storage_size" : 960,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 16,

            "memory_amount" : 65536,

            "name" : "16xCPU-64GB",

            "public_traffic_out" : 10240,

            "storage_size" : 1280,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 20,

            "memory_amount" : 131072,

            "name" : "20xCPU-128GB",

            "public_traffic_out" : 24576,

            "storage_size" : 2048,

            "storage_tier" : "maxiops"

         },

         {

            "core_number" : 20,

            "memory_amount" : 98304,

            "name" : "20xCPU-96GB",

            "public_traffic_out" : 12288,

            "storage_size" : 1920,

            "storage_tier" : "maxiops"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

The memory_amount is in MB, public_traffic_out and storage_size are in GB.

To have your own custom configuration of CPU core count, memory size and disk type and size, you must configure with valid combination of CPU core count and memory size.  The valid combinations are:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server_size

HTTP/1.1 200 OK

Date: Tue, 06 Aug 2019 18:00:24 GMT

Server: Apache

Content-Length: 242550

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server_sizes" : {

      "server_size" : [

         {

            "core_number" : "1",

            "memory_amount" : "1024"

         },

         {

            "core_number" : "1",

            "memory_amount" : "2048"

         },

         {

            "core_number" : "1",

            "memory_amount" : "3072"

         },

         {

            "core_number" : "1",

            "memory_amount" : "4096"

         },

         {

            "core_number" : "1",

            "memory_amount" : "5120"

         },

         {

            "core_number" : "1",

            "memory_amount" : "6144"

         },

______________________________________________________________________________________

List Resouce Prices

List resource prices:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/price

HTTP/1.1 200 OK

Date: Wed, 07 Aug 2019 17:37:34 GMT

Server: Apache

Content-Length: 23707

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "prices" : {

      "zone" : [

         {

            "firewall" : {

               "amount" : 1,

               "price" : 0.56

            },

            "io_request_backup" : {

               "amount" : 1000000,

               "price" : 0

            },

            "io_request_maxiops" : {

               "amount" : 1000000,

               "price" : 0

            },

            "ipv4_address" : {

               "amount" : 1,

               "price" : 0.336

            },

            "ipv6_address" : {

               "amount" : 1,

______________________________________________________________________________________

UpCloud resources are billed by the hour according to the price list.

List Available Templates

UpCloud servers are created from templates.

List available templates:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/template

HTTP/1.1 200 OK

Date: Wed, 07 Aug 2019 17:55:55 GMT

Server: Apache

Content-Length: 4380

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "public",

            "license" : 3.36,

            "size" : 28,

            "state" : "online",

            "title" : "Windows Server 2012 R2 Datacenter",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010050200"

         },

         {

            "access" : "public",

            "license" : 0.694,

            "size" : 28,

            "state" : "online",

            "title" : "Windows Server 2012 R2 Standard",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010050300"

         },

         {

            "access" : "public",

            "license" : 3.36,

            "size" : 28,

            "state" : "online",

            "title" : "Windows Server 2016 Datacenter",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010060200"

         },

         {

            "access" : "public",

            "license" : 0.694,

            "size" : 29,

            "state" : "online",

            "title" : "Windows Server 2016 Standard",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010060300"

         },

         {

            "access" : "public",

            "license" : 3.36,

            "size" : 25,

            "state" : "online",

            "title" : "Windows Server 2019 Datacenter",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010070200"

         },

         {

            "access" : "public",

            "license" : 0.694,

            "size" : 25,

            "state" : "online",

            "title" : "Windows Server 2019 Standard",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000010070300"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "Debian GNU/Linux 8.11 (Jessie)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000020030100"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "Debian GNU/Linux 9.9 (Stretch)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000020040100"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "Debian GNU/Linux 10.0.0 (Buster)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000020050100"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "Ubuntu Server 14.04 LTS (Trusty Tahr)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000030040200"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "Ubuntu Server 16.04 LTS (Xenial Xerus)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000030060200"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 4,

            "state" : "online",

            "title" : "Ubuntu Server 18.04 LTS (Bionic Beaver)",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000030080200"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "CentOS 6.10",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000050010200"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 3,

            "state" : "online",

            "title" : "CentOS 7.6",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000050010300"

         },

         {

            "access" : "public",

            "license" : 0,

            "size" : 5,

            "state" : "online",

            "title" : "CoreOS Stable 1068.8.0",

            "type" : "template",

            "uuid" : "01000000-0000-4000-8000-000080010200"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

The other methods of creating a server are to clone another server, and installing from UpCloud provided CD-ROM.  Users can also create their own templates from an existing storage resource.

Our Server Configuration File

This is our server configuration file:

serverdefinition1

______________________________________________________________________________________

{

  "server": {

    "title": "Our Demo Server",

    "zone": "sg-sin1",

    "timezone": "UTC",

    "hostname": "demo1.example.com",

    "plan": "1xCPU-1GB",

    "video_model": "vga",

    "storage_devices": {

      "storage_device": [

        {

          "action": "clone",

          "storage": "01000000-0000-4000-8000-000030080200",

          "title": "Ubuntu Server 18.04 LTS from UpCloud template",

          "type": "disk",

          "size": "25",

          "tier": "maxiops"

        },

        {

          "action": "create",

          "title": "Data disk",

          "type": "disk",

          "size": "10",

          "tier": "maxiops"

        }

      ]

    },

    "ip_addresses": {

      "ip_address": [

        { "access": "private", "family": "IPv4" },

        { "access": "public", "family": "IPv4" },

        { "access": "public", "family": "IPv6" }

      ]

    },

    "firewall": "on",

    "login_user": {

       "username": "root",

       "create_password": "yes",

       "ssh_keys": {

         "ssh_key": [

            "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5Wb6Dk0mQqSaY4pbFzBrnGXCAV3Z92VoZsynsHesByQRYVWN0wm824Ox9Gp8ZN+VyKS7TXLl9DO5qPCz9kpE0SRTGWVYrDOSGbRD9TP0K1j+jgo5lDoQc3CND/Ri/vGyyE9nn/nsl8vEJ/RBkN1QDpotcxejnC/wy4qG/MISaywHSv1qmh8ULHMrlk74GC1OrLeW1msRNzKam3vNyoNPSyM9S/ytnMX2gJJRAC5YOdlYR4pLXcuJ4wOYymDp3j99F8gcoL3uWd+P9DGlRdgn2ZzsXc1E22rsb8AKDENAVFMPWYHd++PEG/GHXffbPANeeJA4pEoeCjvqprKEeFYJH chingl@trinity.cgl"

         ]

       }

    },

    "password_delivery": "email",

    "vnc": "on",

    "vnc_password": "yourvncpassword",

    "user_data": "useradd -m -U chingl; mkdir /data; mkfs.xfs /dev/vdb; mount /dev/vdb /data"

  }

}

______________________________________________________________________________________

Explanation of the attributes:

title: A up to 64 characters description of the server.

zone : Server is hosted in Singapore #1.

timezone: The server clock is in UTC.

hostname: Up to 128 characters host name with or without domain name.

plan: Plan of 1 CPU core, 1 GB memory, 25 GB MaxIOPS disk selected.

video_model: "vga" gives better resolution than "cirrus" for the console.

storage_devices: The first storage device is a boot device, of type MaxIOPS disk, 25 GB size, that is what the plan provides for.  The disk is cloned from the UpCloud provided Ubuntu Server 18.04 LTS template.  The long string of numbers is the UUID of the template.  There is a descriptive title that is up to 64 characters.

We attach a second storage device, titled "Data disk', of type MaxIOPS disk of 10 GB.  A disk can be up to 2048 GB.

There can be up to eight storage devices in the storage_devices block.

ip_addresses: A server can have up to one private IPv4 address, zero to five public IPv4 addresses, zero to five public IPv6 addresses.  Each IP address is associated with one virtual network interface.  IPv4 addresses are assigned by DHCP.  "IPv6 network interfaces should use stateless address autoconfiguration (SLAAC) with IPv6 privacy extensions disabled. On IPv6-only server DNS parameters can be obtained with stateless DHCPv6."

It is not possible to create subnets or a virtual private network.  Private addresses are only visible to servers under the same UpCloud account.

firewall: UpCloud firewall rules are enabled with value "on".  Value "off" disables UpCloud firewall rules.

login_user block: 

username: We use user name "root".  Other user names will be given sudo privilege.

create_password: Password is created.  If set to "no", user can only login with SSH key.

ssh_keys: 1 to 32 SSH public keys in OpenSSH format.

password_delivery: Password is created and then delivered via email with value "email".  Alternatives are not to send with "none", or via SMS with "sms".

vnc: VNC service is enabled with value "on".  VNC enables access to console of server.  Value "off" disables VNC service.

vnc_password: The VNC remote access password, 8-32 characters of a-z, A-Z and 0-9.

user_data: The commands to run in the operating system after the server has been created, or, the URL for a server setup script.

Issues Discovered

1) In the server definition JASON file, putting "boot_disk" attribute inside "storage_device" will result in error, even though the documentation at https://developers.upcloud.com/1.2/8-servers/ says otherwise.

2) When "video_model" is not specified, the result was "cirrus" with not so good console resolution even though documentation says default is "vga".

3) The disk size has to be explicitly specified or it will default to some value other than the entitlement in the plan.  This example plan of "1xCPU-1GB" should have entitlement of 25 GB MaxIOPS disk.  If the disk size is omitted, a 10 GB MaxIOPS disk is given.  I am told by UpCloud person this is the default behaviour.

The above issues have been communicated to the UpCloud people.

Create server from the server definition file; take note of the assigned IP addresses, OS password "password" given, the server UUID "uuid", VNC host name "vnc_host" and VNC port number "vnc_port":

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/zone

HTTP/1.1 200 OK

Date: Tue, 06 Aug 2019 07:54:34 GMT

Server: Apache

Content-Length: 808

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "zones" : {

      "zone" : [

         {

            "description" : "Frankfurt #1",

            "id" : "de-fra1"

         },

         {

            "description" : "Helsinki #1",

            "id" : "fi-hel1"

         },

         {

            "description" : "Helsinki #2",

            "id" : "fi-hel2"

         },

         {

            "description" : "Amsterdam #1",

            "id" : "nl-ams1"

         },

         {

            "description" : "Singapore #1",

            "id" : "sg-sin1"

         },

         {

            "description" : "London #1",

            "id" : "uk-lon1"

         },

         {

            "description" : "Chicago #1",

            "id" : "us-chi1"

         },

         {

            "description" : "San Jose #1",

            "id" : "us-sjo1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

Introducing UpCloud

UpCloud is a company from Helsinki, Finland.  They claim to have the fastest cloud servers in the world; their claim is backed by third party benchmarking.  They have servers in various locations in the world, including here in Singapore.

https://upcloud.com

A customer virtual machine gets a dedicated CPU core per virtual CPU.  There is only one single type of virtual machine, with no confusing classes of virtual machines to select.  There are only two different storage types, hard disk and MaxIOPS.  MaxIOPS is built on InfiniBand network and SSDs, promising to deliver up to 100,000 IOPS.  There is no selection of SSD performance tiers.  InfiniBand is not commonly used for IT storage.  I do not know of any other public cloud that uses InfiniBand for storage network.  That is how far the company founders are willing to go in pursuit of performance.

UpCloud also promises SLA of 50x payback for down time over 5 minutes.  UpCloud does live migration of customer virtual machines when the host server needs to undergo maintenance, ensuring customer virtual machines do not suffer down time.  Live migration is a very expensive capability to have, which is why most public clouds do not do live migration.

UpCloud provides only Infrastructure as a Service, of virtual machines and block device storage.  Per virtual machine firewall rules are available, as is scheduled backups of storage device.

The proposition is thus the highest performance cloud servers, with costs much lower than the other big three public cloud services.

Public cloud virtual machines with lower than expected compute and storage performance is a not uncommon bane, leading to much more resources than budgeted required to meet performance levels.

Thiere is at least one third party that provides managed databases running in UpCloud.

Introduction to UpCloud REST API

This post introduces life cycle management of virtual machines on UpCloud using their REST API.

UpCloud has built other means of programmatic control of their cloud serice, which are all built on their REST API.  You can check out their GitHub repositories:

https://github.com/UpCloudLtd

I tried out the Python API Client.  It does not seem to have the full functionality of the REST API,  Therefore I would recommend to use the REST API directly from your favourite language.

UpCloud Control Panels

The new user control panel login is at

https://hub.upcloud.com

This new control panel is optimized for mobile and tablet devices, as is the current trend.

The old user control panel login is at:

https://my.upcloud.com

I prefer the old control panel as I can see much more information.

Here I provide introduction to UpCloud REST API by creating a virtual machine, which UpCloud calls a server.

UpCloud REST API

Full documentation of UpCloud REST API:

https://developers.upcloud.com/

It is recommended to create a separate API user in the control panel, which has API access.  That API user should not have access to control panel, and maybe have access restricted by IP address.

UpCloud API uses HTTP Basic authentication.

Both XML and JSON data definitions are available.  We will use the default JSON.

Always check the HTTP status code for response status. 

Successful requests are responded with a response code between 200 and 299.

"200 OK" means request was successful.

"201 Created" means "The request resulted in the generation of a new resource such as a server or a storage."

"202 Accepted" means "The request resulted in the asynchronous creation or update of an existing resource."

List Available Zones

First step is to select the appropriate zone to deploy virtual machine.  Substitute the curl commands with the appropriate user name and password.

List available zones:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @serverdefinition1 --request POST https://api.upcloud.com/1.2/server

HTTP/1.1 100 Continue

HTTP/1.1 202 Accepted

Date: Sat, 10 Aug 2019 13:51:40 GMT

Server: Apache

Content-Length: 2058

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "password" : "62cx228v",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "0",

      "plan_ipv6_bytes" : "0",

      "progress" : "0",

      "state" : "maintenance",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "username" : "root",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

List the servers, and check that the server is running, "state" attribute should be "started":

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server

HTTP/1.1 200 OK

Date: Sat, 10 Aug 2019 14:17:21 GMT

Server: Apache

Content-Length: 564

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "servers" : {

      "server" : [

         {

            "core_number" : "1",

            "hostname" : "demo1.example.com",

            "license" : 0,

            "memory_amount" : "1024",

            "plan" : "1xCPU-1GB",

            "plan_ipv4_bytes" : "69698",

            "plan_ipv6_bytes" : "1754",

            "state" : "started",

            "tags" : {

               "tag" : []

            },

            "title" : "Our Demo Server",

            "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Get detailed information about the server, the server UUID is appended to the end of the GET HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 200 OK

Date: Sat, 10 Aug 2019 14:25:24 GMT

Server: Apache

Content-Length: 2006

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "host" : 6477857411,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99372",

      "plan_ipv6_bytes" : "1950",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 1 UDP IPv6",

    "direction": "in",

    "family": "IPv6",

    "position": "502",

    "protocol": "udp",

    "source_address_end": "2a04:3540:53::1",

    "source_address_start": "2a04:3540:53::1",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

Firewall

Please note that the UpCloud firewall is chargeable once the firewall service is enabled in the server.

Alternaively, firewall in OS can be used instead of the UpCloud firewall.

Network traffic is checked against the firewall rules in numerical order starting from the first rule.  The first rule that matches is applied.

The firewall rules have to be added one by one in sequential order starting from the rule with the highest precedence.  Unfortunately it is not possible to put all the firewall rule definitions in a single input file.

Please note that all attributes in the firewall rule JASON file must not have empty values.  All attributes with empty values must be omitted from the JASON file or "HTTP/1.1 400 Bad Request" will be returned.

The attributes are:

action: "accept" or "drop" the traffic.

comment: Up to 250 characters description of the rule.

destination_address_start and destination_address_end: IP address range of destination.

destination_port_start and destination_port_end: Port number range of destination.

direction: "in" or "out" direction of network traffic.

family: "IPv4" or "IPv6".

icmp_type: ICMP type of ICMP traffic, 0 to 255.

position: "1" to "1000", postion number of the rule with respect to the absolute position numbers of the existing rules. All existing rules are numbered sequentially, starting from number 1.  The new rule is be inserted either at the position number where a rule already exisits, moving the other existing rules from that position onwards one postion number greater, or appended to the end of all rules if the position number is greater than the number of existing rules.

protocol: "icmp", "tcp" or "udp".

source_address_start and source_address_end: IP address range of source.

source_port_start and source_port_end: Port number range of source.

From the documentation in control panel:

"Please note that DNS traffic must also be explicitly allowed. Our DNS servers are 94.237.127.9 and 94.237.40.9 (in IPv6 network 2a04:3540:53::1 and 2a04:3544:53::1). Incoming TCP and UDP traffic from source port 53 must be allowed from these hosts."

We add the rules for the DNS servers as described above.

firewallrule-501-DNS1-TCP-IPv6-in-allowed

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 1 TCP IPv6",

    "direction": "in",

    "family": "IPv6",

    "position": "501",

    "protocol": "tcp",

    "source_address_end": "2a04:3540:53::1",

    "source_address_start": "2a04:3540:53::1",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

______________________________________________________________________________________

The server UUID is in the POST HTTPS URL.

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-501-DNS1-TCP-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 06:57:39 GMT

Server: Apache

Content-Length: 554

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 1 TCP IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "",

      "position" : "1",

      "protocol" : "tcp",

      "source_address_end" : "2a04:3540:53::1",

      "source_address_start" : "2a04:3540:53::1",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

firewallrule-502-DNS1-UDP-IPv6-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-502-DNS1-UDP-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 07:08:02 GMT

Server: Apache

Content-Length: 554

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 1 UDP IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "",

      "position" : "2",

      "protocol" : "udp",

      "source_address_end" : "2a04:3540:53::1",

      "source_address_start" : "2a04:3540:53::1",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

_____________________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 2 TCP IPv6",

    "direction": "in",

    "family": "IPv6",

    "position": "503",

    "protocol": "tcp",

    "source_address_end": "2a04:3544:53::1",

    "source_address_start": "2a04:3544:53::1",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-503-DNS2-TCP-IPv6-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-503-DNS2-TCP-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 07:19:56 GMT

Server: Apache

Content-Length: 554

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 2 TCP IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "",

      "position" : "3",

      "protocol" : "tcp",

      "source_address_end" : "2a04:3544:53::1",

      "source_address_start" : "2a04:3544:53::1",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

_____________________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 2 UDP IPv6",

    "direction": "in",

    "family": "IPv6",

    "position": "504",

    "protocol": "udp",

    "source_address_end": "2a04:3544:53::1",

    "source_address_start": "2a04:3544:53::1",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-504-DNS2-UDP-IPv6-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-504-DNS2-UDP-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 07:29:04 GMT

Server: Apache

Content-Length: 554

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 2 UDP IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "",

      "position" : "4",

      "protocol" : "udp",

      "source_address_end" : "2a04:3544:53::1",

      "source_address_start" : "2a04:3544:53::1",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 1 TCP IPv4",

    "direction": "in",

    "family": "IPv4",

    "position": "505",

    "protocol": "tcp",

    "source_address_end": "94.237.127.9",

    "source_address_start": "94.237.127.9",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-505-DNS1-TCP-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-505-DNS1-TCP-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 07:40:34 GMT

Server: Apache

Content-Length: 548

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 1 TCP IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "5",

      "protocol" : "tcp",

      "source_address_end" : "94.237.127.9",

      "source_address_start" : "94.237.127.9",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 1 UDP IPv4",

    "direction": "in",

    "family": "IPv4",

    "position": "506",

    "protocol": "udp",

    "source_address_end": "94.237.127.9",

    "source_address_start": "94.237.127.9",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-506-DNS1-UDP-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-506-DNS1-UDP-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 07:51:09 GMT

Server: Apache

Content-Length: 548

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 1 UDP IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "6",

      "protocol" : "udp",

      "source_address_end" : "94.237.127.9",

      "source_address_start" : "94.237.127.9",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 2 TCP IPv4",

    "direction": "in",

    "family": "IPv4",

    "position": "507",

    "protocol": "tcp",

    "source_address_end": "94.237.40.9",

    "source_address_start": "94.237.40.9",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-507-DNS2-TCP-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-507-DNS2-TCP-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 08:12:03 GMT

Server: Apache

Content-Length: 546

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 2 TCP IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "7",

      "protocol" : "tcp",

      "source_address_end" : "94.237.40.9",

      "source_address_start" : "94.237.40.9",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

_____________________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow UpCloud DNS Server 2 UDP IPv4",

    "direction": "in",

    "family": "IPv4",

    "position": "508",

    "protocol": "udp",

    "source_address_end": "94.237.40.9",

    "source_address_start": "94.237.40.9",

    "source_port_end": "53",

    "source_port_start": "53"

  }

}

firewallrule-508-DNS2-UDP-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-508-DNS2-UDP-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 08:33:31 GMT

Server: Apache

Content-Length: 546

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow UpCloud DNS Server 2 UDP IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "8",

      "protocol" : "udp",

      "source_address_end" : "94.237.40.9",

      "source_address_start" : "94.237.40.9",

      "source_port_end" : "53",

      "source_port_start" : "53"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

_____________________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow HTTP from anywhere IPv4",

    "destination_port_end": "80",

    "destination_port_start": "80",

    "direction": "in",

    "family": "IPv4",

    "position": "601",

    "protocol": "tcp"

  }

}

We allow HTTP to port 80 for both IPv4 and IPv6.

firewallrule-601-HTTP-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-601-HTTP-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 08:46:16 GMT

Server: Apache

Content-Length: 518

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow HTTP from anywhere IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "80",

      "destination_port_start" : "80",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "9",

      "protocol" : "tcp",

      "source_address_end" : "",

      "source_address_start" : "",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow HTTP from anywhere IPv6",

    "destination_port_end": "80",

    "destination_port_start": "80",

    "direction": "in",

    "family": "IPv6",

    "position": "602",

    "protocol": "tcp"

  }

}

firewallrule-602-HTTP-IPv6-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-602-HTTP-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 08:54:16 GMT

Server: Apache

Content-Length: 519

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow HTTP from anywhere IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "80",

      "destination_port_start" : "80",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "",

      "position" : "10",

      "protocol" : "tcp",

      "source_address_end" : "",

      "source_address_start" : "",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

    "action": "accept",

    "comment": "Allow SSH from a specific network IPv4 only",

    "destination_port_end": "22",

    "destination_port_start": "22",

    "direction": "in",

    "family": "IPv4",

    "position": "701",

    "protocol": "tcp",

    "source_address_end": "202.102.122.64",

    "source_address_start": "202.102.122.64"

  }

}

Allow SSH from only specified IP address.

firewallrule-701-SSH-IPv4-restricted

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-701-SSH-IPv4-restricted --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 13:08:08 GMT

Server: Apache

Content-Length: 561

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow SSH from a specific network IPv4 only",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "22",

      "destination_port_start" : "22",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "",

      "position" : "11",

      "protocol" : "tcp",

      "source_address_end" : "202.102.122.64",

      "source_address_start" : "202.102.122.64",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

_____________________________________________________________________________________________

{

  "firewall_rule": {

     "action": "accept",

     "comment": "Allow ICMP echo request (ping) IPv4",

     "direction": "in",

     "family": "IPv4",

     "icmp_type": "8",

     "position": "801",

     "protocol": "icmp"

  }

}

Allow ping of the server.

firewallrule-801-ping-IPv4-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-801-ping-IPv4-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 18:02:09 GMT

Server: Apache

Content-Length: 523

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow ICMP echo request (ping) IPv4",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv4",

      "icmp_type" : "8",

      "position" : "12",

      "protocol" : "icmp",

      "source_address_end" : "",

      "source_address_start" : "",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

{

  "firewall_rule": {

     "action": "accept",

     "comment": "Allow ICMP echo request (ping) IPv6",

     "direction": "in",

     "family": "IPv6",

     "icmp_type": "8",

     "position": "802",

     "protocol": "icmp"

  }

}

______________________________________________________________________________________

firewallrule-802-ping-IPv6-in-allowed

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-802-ping-IPv6-in-allowed --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sat, 24 Aug 2019 19:09:00 GMT

Server: Apache

Content-Length: 523

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "accept",

      "comment" : "Allow ICMP echo request (ping) IPv6",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "IPv6",

      "icmp_type" : "8",

      "position" : "13",

      "protocol" : "icmp",

      "source_address_end" : "",

      "source_address_start" : "",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

______________________________________________________________________________________

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @firewallrule-1000-All-in-drop --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 201 Created

Date: Sun, 25 Aug 2019 18:16:09 GMT

Server: Apache

Content-Length: 504

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rule" : {

      "action" : "drop",

      "comment" : "Drop everything for ingress",

      "destination_address_end" : "",

      "destination_address_start" : "",

      "destination_port_end" : "",

      "destination_port_start" : "",

      "direction" : "in",

      "family" : "",

      "icmp_type" : "",

      "position" : "14",

      "protocol" : "",

      "source_address_end" : "",

      "source_address_start" : "",

      "source_port_end" : "",

      "source_port_start" : ""

   }

}

chingl@trinity:~/testing/UpCloud>

_____________________________________________________________________________________________

List all the firewall rules of the server.  The server UUID is in the GET HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/firewall_rule

HTTP/1.1 200 OK

Date: Sun, 25 Aug 2019 18:28:21 GMT

Server: Apache

Content-Length: 8752

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "firewall_rules" : {

      "firewall_rule" : [

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 1 TCP IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "",

            "position" : "1",

            "protocol" : "tcp",

            "source_address_end" : "2a04:3540:53::1",

            "source_address_start" : "2a04:3540:53::1",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 1 UDP IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "",

            "position" : "2",

            "protocol" : "udp",

            "source_address_end" : "2a04:3540:53::1",

            "source_address_start" : "2a04:3540:53::1",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 2 TCP IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "",

            "position" : "3",

            "protocol" : "tcp",

            "source_address_end" : "2a04:3544:53::1",

            "source_address_start" : "2a04:3544:53::1",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 2 UDP IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "",

            "position" : "4",

            "protocol" : "udp",

            "source_address_end" : "2a04:3544:53::1",

            "source_address_start" : "2a04:3544:53::1",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 1 TCP IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "5",

            "protocol" : "tcp",

            "source_address_end" : "94.237.127.9",

            "source_address_start" : "94.237.127.9",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 1 UDP IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "6",

            "protocol" : "udp",

            "source_address_end" : "94.237.127.9",

            "source_address_start" : "94.237.127.9",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 2 TCP IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "7",

            "protocol" : "tcp",

            "source_address_end" : "94.237.40.9",

            "source_address_start" : "94.237.40.9",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow UpCloud DNS Server 2 UDP IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "8",

            "protocol" : "udp",

            "source_address_end" : "94.237.40.9",

            "source_address_start" : "94.237.40.9",

            "source_port_end" : "53",

            "source_port_start" : "53"

         },

         {

            "action" : "accept",

            "comment" : "Allow HTTP from anywhere IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "80",

            "destination_port_start" : "80",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "9",

            "protocol" : "tcp",

            "source_address_end" : "",

            "source_address_start" : "",

            "source_port_end" : "",

            "source_port_start" : ""

         },

         {

            "action" : "accept",

            "comment" : "Allow HTTP from anywhere IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "80",

            "destination_port_start" : "80",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "",

            "position" : "10",

            "protocol" : "tcp",

            "source_address_end" : "",

            "source_address_start" : "",

            "source_port_end" : "",

            "source_port_start" : ""

         },

         {

            "action" : "accept",

            "comment" : "Allow SSH from a specific network IPv4 only",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "22",

            "destination_port_start" : "22",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "",

            "position" : "11",

            "protocol" : "tcp",

            "source_address_end" : "202.102.122.64",

            "source_address_start" : "202.102.122.64",

            "source_port_end" : "",

            "source_port_start" : ""

         },

         {

            "action" : "accept",

            "comment" : "Allow ICMP echo request (ping) IPv4",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv4",

            "icmp_type" : "8",

            "position" : "12",

            "protocol" : "icmp",

            "source_address_end" : "",

            "source_address_start" : "",

            "source_port_end" : "",

            "source_port_start" : ""

         },

         {

            "action" : "accept",

            "comment" : "Allow ICMP echo request (ping) IPv6",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "IPv6",

            "icmp_type" : "8",

            "position" : "13",

            "protocol" : "icmp",

            "source_address_end" : "",

            "source_address_start" : "",

            "source_port_end" : "",

            "source_port_start" : ""

         },

         {

            "action" : "drop",

            "comment" : "Drop everything for ingress",

            "destination_address_end" : "",

            "destination_address_start" : "",

            "destination_port_end" : "",

            "destination_port_start" : "",

            "direction" : "in",

            "family" : "",

            "icmp_type" : "",

            "position" : "14",

            "protocol" : "",

            "source_address_end" : "",

            "source_address_start" : "",

            "source_port_end" : "",

            "source_port_start" : ""

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

_____________________________________________________________________________________________

Interactive Server Console

UpCloud provides an interactive server console.  This is a very useful feature that is seriously lacking in many other clioud providers.  One can access the server console either from the user control panel, or via a VNC client using the server VNC host name, VNC password and port number.

Interactive console access is very useful when one cannot connect to the server using the network, or to do remedial action when there is a fault.

See the screen shots below of the server console.

{

  "firewall_rule": {

     "action": "drop",

     "comment": "Drop everything for ingress",

     "direction": "in",

     "position": "1000"

  }

}

Drop all other ingress traffic.

firewallrule-1000-All-in-drop

______________________________________________________________________________________

The server console login prompt.

After logging in as root.

Note that this particular Ubuntu server template is configured with Finnish keyboard.  That might create problems for people who are using a non-Finnish keyboard as certain keys are mapped differently.

See the screen shot below of SSH into the server using the matching private key.  Note that the commands in "user_data" in the server configuration file have been executed.  The DNS server is also accessible, as shown by the fact that the Ubuntu OS update list has been refreshed by accessing an external server.

The CPU is a high clock speed Intel Xeon workstation SKU.

You can see information about the UpCloud hypervisor.

______________________________________________________________________________________

Attribute:

title: Up to 64 characters description.

The UUID of the data disk is in the POST HTTPS URL.

______________________________________________________________________________________

{

  "storage": {

    "title": "Manually created backup"

  }

}

Manual Backup

Create a manual point-in-time backup of the data disk.

manual-backup

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @manual-backup --request POST https://api.upcloud.com/1.2/storage/01b93946-5a69-44ae-8a4b-e221d119139a/backup

HTTP/1.1 201 Created

Date: Wed, 28 Aug 2019 17:59:58 GMT

Server: Apache

Content-Length: 448

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "created" : "2019-08-28T17:59:58Z",

      "license" : 0,

      "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "progress" : "0",

      "servers" : {

         "server" : []

      },

      "size" : 10,

      "state" : "maintenance",

      "title" : "Manually created backup",

      "type" : "backup",

      "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

List the private storages:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Wed, 28 Aug 2019 18:02:01 GMT

Server: Apache

Content-Length: 1212

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "created" : "2019-08-28T17:59:58Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Manually created backup",

            "type" : "backup",

            "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/01b93946-5a69-44ae-8a4b-e221d119139a

HTTP/1.1 200 OK

Date: Wed, 28 Aug 2019 18:12:08 GMT

Server: Apache

Content-Length: 532

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "backup_rule" : {},

      "backups" : {

         "backup" : [

            "018bdad6-3966-42ea-bcce-ae28c74028c4"

         ]

      },

      "license" : 0,

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      },

      "size" : 10,

      "state" : "online",

      "tier" : "maxiops",

      "title" : "Data disk",

      "type" : "normal",

      "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/018bdad6-3966-42ea-bcce-ae28c74028c4

HTTP/1.1 200 OK

Date: Wed, 28 Aug 2019 18:22:04 GMT

Server: Apache

Content-Length: 419

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "created" : "2019-08-28T17:59:58Z",

      "license" : 0,

      "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "servers" : {

         "server" : []

      },

      "size" : 10,

      "state" : "online",

      "title" : "Manually created backup",

      "type" : "backup",

      "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Restore Backup

To demonstrate restore of disk data from backup, we write a file to the data disk:

______________________________________________________________________________________

Attributes:

stop_type: "soft" or "hard". Soft stopping sends ACPI graceful shutdown signal to the server.

"timeout": Value of "1" to "600", can be omitted.  If set, do hard stop after the timeout value in seconds if the server is still running.

The server UUID is in the POST HTTPS URL.

______________________________________________________________________________________

{

  "stop_server": {

    "stop_type": "soft",

    "timeout": "600"

  }

}

Now we will restore data disk to the previous state before the file write by using the manual point-in-time backup.

We have to stop the server first before doing the restore.

stop-server-soft-600

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @stop-server-soft-600 --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/stop

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 04:54:42 GMT

Server: Apache

Content-Length: 2011

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "host" : 6477857411,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99260509",

      "plan_ipv6_bytes" : "548848",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Check server status:

______________________________________________________________________________________

Attribute "state" with value "stopped" shows that the server has been stopped.

Restore the backup to the data disk.  The UUID of the backup is in the POST HTTPS URL.

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request POST https://api.upcloud.com/1.2/storage/018bdad6-3966-42ea-bcce-ae28c74028c4/restore

HTTP/1.1 204 No Content

Date: Thu, 29 Aug 2019 06:37:10 GMT

Server: Apache

Connection: close

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Check the status of the restore:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 05:00:09 GMT

Server: Apache

Content-Length: 1984

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99260509",

      "plan_ipv6_bytes" : "548848",

      "state" : "stopped",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

The restore has been completed when "state" attribute of data disk has value "online".

Now we can start the server.  Server UUID is in POST HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 06:38:23 GMT

Server: Apache

Content-Length: 1213

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "created" : "2019-08-28T17:59:58Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Manually created backup",

            "type" : "backup",

            "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "syncing",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 06:41:12 GMT

Server: Apache

Content-Length: 1213

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "created" : "2019-08-28T17:59:58Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Manually created backup",

            "type" : "backup",

            "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "syncing",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 06:45:11 GMT

Server: Apache

Content-Length: 1212

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "created" : "2019-08-28T17:59:58Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Manually created backup",

            "type" : "backup",

            "uuid" : "018bdad6-3966-42ea-bcce-ae28c74028c4",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Server start is very quick, taking less than one minute.

We SSH into the server and check on the restore.

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/start

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 07:56:46 GMT

Server: Apache

Content-Length: 2011

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "host" : 5940986499,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99260509",

      "plan_ipv6_bytes" : "548848",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

The data disk has been restored to the state before the file write.

Delete Storage

Delete the backup, which is storage of "type" "backup".  Backup UUID is in DELETE HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request DELETE https://api.upcloud.com/1.2/storage/018bdad6-3966-42ea-bcce-ae28c74028c4

HTTP/1.1 204 No Content

Date: Thu, 29 Aug 2019 08:21:30 GMT

Server: Apache

Connection: close

               

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 08:22:09 GMT

Server: Apache

Content-Length: 788

Connection: close

Content-Type: application/json; charset=UTF-8

         

{     

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Schedule Automatic Backups

We schedule automatic backups of the data disk.

schedule-backup-Sat-2000-180

______________________________________________________________________________________

{

  "storage": {

    "backup_rule": {

      "interval": "sat",

      "time": "2000",

      "retention": "180"

    }

  }

}

______________________________________________________________________________________

Attributes are:

interval: Day of the week a backup is done.  Values are "daily", "mon", "tue", "wed", "thu", "fri", "sat" or "sun", values are self-explanatory.

time: Time of day the backup is created, "0000" to "2359".

retention: Number of days before a backup is automatically deleted. "1" to "1095".  Maximum retention of 3 years.

In this example, we schedule weekly backups on Saturday, 2000 UTC, with retention of 180 days.

We modify the data disk storage.  Data disk UUID is in PUT HTTPS URL:

______________________________________________________________________________________

We modify the server.  Server UUID is in PUT HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @server-change-2xCPU-4GB --request PUT https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 202 Accepted

Date: Mon, 02 Sep 2019 06:05:10 GMT

Server: Apache

Content-Length: 1979

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "0",

      "plan_ipv6_bytes" : "0",

      "state" : "stopped",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Check that the server is not in state "maintenance":

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 06:19:05 GMT

Server: Apache

Content-Length: 1979

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "0",

      "plan_ipv6_bytes" : "0",

      "state" : "stopped",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

We start the server:

______________________________________________________________________________________

{

  "server" : {

    "title": "Our bigger Demo Server",

    "plan" : "2xCPU-4GB"

  }

}

______________________________________________________________________________________

We get the details of the data disk.  The data disk UUID is in GET HTTPS URL.

Checking the Scheduled Backup

We check that the scheduled backup was done:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 04:24:13 GMT

Server: Apache

Content-Length: 1205

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "license" : 0,

            "part_of_plan" : "yes",

            "size" : 25,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Ubuntu Server 18.04 LTS from UpCloud template",

            "type" : "normal",

            "uuid" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "license" : 0,

            "size" : 10,

            "state" : "online",

            "tier" : "maxiops",

            "title" : "Data disk",

            "type" : "normal",

            "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "zone" : "sg-sin1"

         },

         {

            "access" : "private",

            "created" : "2019-08-31T20:13:22Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Scheduled Backup",

            "type" : "backup",

            "uuid" : "01cec459-ceb4-4ff1-aff1-ed5ab4072924",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/01b93946-5a69-44ae-8a4b-e221d119139a

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 04:27:58 GMT

Server: Apache

Content-Length: 623

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "backup_rule" : {

         "interval" : "sat",

         "retention" : "180",

         "time" : "2000"

      },

      "backups" : {

         "backup" : [

            "01cec459-ceb4-4ff1-aff1-ed5ab4072924"

         ]

      },

      "license" : 0,

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      },

      "size" : 10,

      "state" : "online",

      "tier" : "maxiops",

      "title" : "Data disk",

      "type" : "normal",

      "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/01cec459-ceb4-4ff1-aff1-ed5ab4072924

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 04:28:53 GMT

Server: Apache

Content-Length: 412

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "created" : "2019-08-31T20:13:22Z",

      "license" : 0,

      "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "servers" : {

         "server" : []

      },

      "size" : 10,

      "state" : "online",

      "title" : "Scheduled Backup",

      "type" : "backup",

      "uuid" : "01cec459-ceb4-4ff1-aff1-ed5ab4072924",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

We listed the private storages and got the detailed information of the data disk and the backup to confirm that the scheduled backup was completed.

Resizing the Server

We can resize the server by changing the number of CPU cores, memory size and the disk size.  We cannot resize number of CPU cores and memory size when the server is running and must first stop the server.

We do soft stop of the server with timeout of 600 s:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @stop-server-soft-600 --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/stop

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 05:43:17 GMT

Server: Apache

Content-Length: 2011

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "host" : 5940986499,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99447982",

      "plan_ipv6_bytes" : "571702",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 05:45:57 GMT

Server: Apache

Content-Length: 1984

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "1",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "1024",

      "nic_model" : "virtio",

      "plan" : "1xCPU-1GB",

      "plan_ipv4_bytes" : "99447982",

      "plan_ipv6_bytes" : "571702",

      "state" : "stopped",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

We change to the plan "2xCPU-4GB".  While this plan has entitlement of MaxIOPS SSD of 80 GB, we leave the storage size of 25 GB unchanged so that we can change back to the smaller plans later.  We also change the title to reflect the new server size.

server-change-2xCPU-4GB

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @schedule-backup-Sat-2000-180 --request PUT https://api.upcloud.com/1.2/storage/01b93946-5a69-44ae-8a4b-e221d119139a

HTTP/1.1 202 Accepted

Date: Thu, 29 Aug 2019 08:43:08 GMT

Server: Apache

Content-Length: 562

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "backup_rule" : {

         "interval" : "sat",

         "retention" : "180",

         "time" : "2000"

      },

      "backups" : {

         "backup" : []

      },

      "license" : 0,

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      },

      "size" : 10,

      "state" : "online",

      "tier" : "maxiops",

      "title" : "Data disk",

      "type" : "normal",

      "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/01b93946-5a69-44ae-8a4b-e221d119139a

HTTP/1.1 200 OK

Date: Thu, 29 Aug 2019 08:48:11 GMT

Server: Apache

Content-Length: 562

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storage" : {

      "access" : "private",

      "backup_rule" : {

         "interval" : "sat",

         "retention" : "180",

         "time" : "2000"

      },

      "backups" : {

         "backup" : []

      },

      "license" : 0,

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      },

      "size" : 10,

      "state" : "online",

      "tier" : "maxiops",

      "title" : "Data disk",

      "type" : "normal",

      "uuid" : "01b93946-5a69-44ae-8a4b-e221d119139a",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/start

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 06:32:53 GMT

Server: Apache

Content-Length: 2006

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "host" : 4464591491,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "0",

      "plan_ipv6_bytes" : "0",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : []

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

We SSH into the server to check:

The memory is now 4 GB.

We now have two CPU cores, from a newer processor than before, a high clock speed Intel Xeon Gold 6136.

IP Addresses

See the three network interfaces:

List all IP addresses assigned to servers:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/ip_address

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 07:41:56 GMT

Server: Apache

Content-Length: 859

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "ip_addresses" : {

      "ip_address" : [

         {

            "access" : "public",

            "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

            "family" : "IPv6",

            "ptr_record" : "c00c-02ff-fecb-758d.v6.sg-sin1.upcloud.host",

            "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         },

         {

            "access" : "private",

            "address" : "10.10.3.37",

            "family" : "IPv4",

            "ptr_record" : "",

            "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         },

         {

            "access" : "public",

            "address" : "94.237.76.17",

            "family" : "IPv4",

            "part_of_plan" : "yes",

            "ptr_record" : "94-237-76-17.sg-sin1.upcloud.host",

            "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Get detailed information about each IP address.  The specific IP address queried is in GET HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/ip_address/2a04:3543:1000:2310:c00c:02ff:fecb:758d

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 07:51:18 GMT

Server: Apache

Content-Length: 266

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "ip_address" : {

      "access" : "public",

      "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

      "family" : "IPv6",

      "ptr_record" : "c00c-02ff-fecb-758d.v6.sg-sin1.upcloud.host",

      "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/ip_address/10.10.3.37

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 07:58:33 GMT

Server: Apache

Content-Length: 195

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "ip_address" : {

      "access" : "private",

      "address" : "10.10.3.37",

      "family" : "IPv4",

      "ptr_record" : "",

      "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/ip_address/94.237.76.17

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 07:59:23 GMT

Server: Apache

Content-Length: 259

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "ip_address" : {

      "access" : "public",

      "address" : "94.237.76.17",

      "family" : "IPv4",

      "part_of_plan" : "yes",

      "ptr_record" : "94-237-76-17.sg-sin1.upcloud.host",

      "server" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

DNS PTR Record of Public IP Addresses

The Public IP addresses have DNS PTR record.  We check them out:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> host c00c-02ff-fecb-758d.v6.sg-sin1.upcloud.host 8.8.8.8

Using domain server:

Name: 8.8.8.8

Address: 8.8.8.8#53

Aliases:

c00c-02ff-fecb-758d.v6.sg-sin1.upcloud.host has IPv6 address 2a04:3543:1000:2310:c00c:2ff:fecb:758d

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> host 2a04:3543:1000:2310:c00c:2ff:fecb:758d 8.8.8.8

Using domain server:

Name: 8.8.8.8

Address: 8.8.8.8#53

Aliases:

d.8.5.7.b.c.e.f.f.f.2.0.c.0.0.c.0.1.3.2.0.0.0.1.3.4.5.3.4.0.a.2.ip6.arpa domain name pointer c00c-02ff-fecb-758d.v6.sg-sin1.upcloud.host.

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> host 94-237-76-17.sg-sin1.upcloud.host 8.8.8.8

Using domain server:

Name: 8.8.8.8

Address: 8.8.8.8#53

Aliases:

94-237-76-17.sg-sin1.upcloud.host has address 94.237.76.17

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> host 94.237.76.17 8.8.8.8

Using domain server:

Name: 8.8.8.8

Address: 8.8.8.8#53

Aliases:

17.76.237.94.in-addr.arpa domain name pointer 94-237-76-17.sg-sin1.upcloud.host.

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

The DNS PTR record of a public IP address can be modified.

Very Fast Update and Bootup

I updated the Ubuntu OS.  The update was completed very quickly.  Then the server was rebooted.

According to the system logs:

______________________________________________________________________________________

Sep 02 10:11:37 demo1.example.com systemd[1]: Shutting down.

Sep 02 10:11:37 demo1.example.com systemd-shutdown[1]: Syncing filesystems and block devices.

Sep 02 10:11:37 demo1.example.com systemd-shutdown[1]: Sending SIGTERM to remaining processes...

Sep 02 10:11:37 demo1.example.com systemd-journald[2883]: Journal stopped

-- Reboot --

Sep 02 10:11:44 demo1.example.com kernel: Linux version 4.15.0-52-generic (buildd@lgw01-amd64-051) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #56-Ubuntu SMP Tue Jun 4 22:49:08 UTC 2019 (Ubun

Sep 02 10:11:44 demo1.example.com kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-4.15.0-52-generic root=UUID=027d08d6-9b74-45c4-b835-83f1e444857d ro net.ifnames=0 biosdevname=0

Sep 02 10:11:44 demo1.example.com kernel: KERNEL supported cpus:

Sep 02 10:11:44 demo1.example.com kernel:   Intel GenuineIntel

Sep 02 10:11:44 demo1.example.com kernel:   AMD AuthenticAMD

Sep 02 10:11:44 demo1.example.com kernel:   Centaur CentaurHauls

Sep 02 10:11:44 demo1.example.com kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'

                   ---------------------------------

Sep 02 10:12:06 demo1.example.com systemd[1169]: Reached target Timers.

Sep 02 10:12:06 demo1.example.com systemd[1169]: Reached target Sockets.

Sep 02 10:12:06 demo1.example.com systemd[1169]: Reached target Paths.

Sep 02 10:12:06 demo1.example.com systemd[1169]: Reached target Basic System.

Sep 02 10:12:06 demo1.example.com systemd[1]: Started User Manager for UID 0.

Sep 02 10:12:06 demo1.example.com systemd[1169]: Reached target Default.

Sep 02 10:12:06 demo1.example.com systemd[1169]: Startup finished in 34ms.

Sep 02 10:12:08 demo1.example.com systemd-resolved[833]: Using degraded feature set (UDP) for DNS server 94.237.127.9.

______________________________________________________________________________________

The startup completed in less than 30 s.  That is very fast indeed!

Tags

Tags can be used to organize servers for easier identification.

Only the main account can create and modify tags.  Enable REST API access for the main account to enable creating tags using REST API.

tag-DEV

______________________________________________________________________________________

{

  "tag": {

    "name": "DEV",

    "description": "Development servers"

  }

}

______________________________________________________________________________________

The attributes:

name: The tag name, "1-32 characters A-Z, a-z, 0-9, _".

description: Description of the tag, "A string of max 255 characters".

Create the new tag "DEV":

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourmainaccount:yourmainpassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @tag-DEV --request POST https://api.upcloud.com/1.2/tag

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 12:16:54 GMT

Server: Apache

Content-Length: 140

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tag" : {

      "description" : "Development servers",

      "name" : "DEV",

      "servers" : {

         "server" : []

      }

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Create new tag "webserver".

tag-webserver

______________________________________________________________________________________

{

  "tag": {

    "name": "webserver",

    "description": "Web servers"

  }

}

______________________________________________________________________________________

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourmainaccount:yourmainpassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @tag-webserver --request POST https://api.upcloud.com/1.2/tag

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 12:21:16 GMT

Server: Apache

Content-Length: 138

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tag" : {

      "description" : "Web servers",

      "name" : "webserver",

      "servers" : {

         "server" : []

      }

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

In the UpCloud control panel, grant the API user access to the two tags created.

List the tags accessible to the API user:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/tag

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 12:40:33 GMT

Server: Apache

Content-Length: 386

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tags" : {

      "tag" : [

         {

            "description" : "Development servers",

            "name" : "DEV",

            "servers" : {

               "server" : []

            }

         },

         {

            "description" : "Web servers",

            "name" : "webserver",

            "servers" : {

               "server" : []

            }

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

From the API documentation:

"Creating and modifying tags is allowed only by main account. Sub-accounts have access only to listing tags and tagging servers they are granted access to."

However, when I attempt to tag the server with API user, the operation fails:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/tag/DEV,webserver

HTTP/1.1 403 Forbidden

Date: Mon, 02 Sep 2019 17:06:11 GMT

Server: Apache

Content-Length: 126

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "error" : {

      "error_code" : "ACTION_FORBIDDEN",

      "error_message" : "The requested action is forbidden."

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Tagging of server has to be done using the main account:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourmainaccount:yourmainpassword" --header "Accept: application/json" --header "Content-Type: application/json" --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/tag/DEV,webserver

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 17:07:56 GMT

Server: Apache

Content-Length: 2070

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "host" : 7954252419,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "1984250",

      "plan_ipv6_bytes" : "516671",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : [

            "DEV",

            "webserver"

         ]

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Using API user, list the tags:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/tag

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 17:45:26 GMT

Server: Apache

Content-Length: 532

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tags" : {

      "tag" : [

         {

            "description" : "Development servers",

            "name" : "DEV",

            "servers" : {

               "server" : [

                  "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

               ]

            }

         },

         {

            "description" : "Web servers",

            "name" : "webserver",

            "servers" : {

               "server" : [

                  "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

               ]

            }

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/tag/DEV

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 17:50:54 GMT

Server: Apache

Content-Length: 201

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tag" : {

      "description" : "Development servers",

      "name" : "DEV",

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      }

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/tag/webserver

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 17:51:40 GMT

Server: Apache

Content-Length: 199

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "tag" : {

      "description" : "Web servers",

      "name" : "webserver",

      "servers" : {

         "server" : [

            "00fb5e0d-4057-4a5d-bde1-abab4223f48d"

         ]

      }

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Delete Server and Storage

The last stage of the life cycle management of a cloud server is to delete the server when it is no longer needed.

The server must be in "stopped" state before it can be deleted.

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --data @stop-server-soft-600 --request POST https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/stop

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 18:24:39 GMT

Server: Apache

Content-Length: 2070

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "host" : 7954252419,

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "2009288",

      "plan_ipv6_bytes" : "517611",

      "state" : "started",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : [

            "DEV",

            "webserver"

         ]

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 18:26:37 GMT

Server: Apache

Content-Length: 2043

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "server" : {

      "boot_order" : "disk",

      "core_number" : "2",

      "firewall" : "on",

      "hostname" : "demo1.example.com",

      "ip_addresses" : {

         "ip_address" : [

            {

               "access" : "private",

               "address" : "10.10.3.37",

               "family" : "IPv4"

            },

            {

               "access" : "public",

               "address" : "2a04:3543:1000:2310:c00c:02ff:fecb:758d",

               "family" : "IPv6"

            },

            {

               "access" : "public",

               "address" : "94.237.76.17",

               "family" : "IPv4",

               "part_of_plan" : "yes"

            }

         ]

      },

      "license" : 0,

      "memory_amount" : "4096",

      "nic_model" : "virtio",

      "plan" : "2xCPU-4GB",

      "plan_ipv4_bytes" : "2009288",

      "plan_ipv6_bytes" : "517611",

      "state" : "stopped",

      "storage_devices" : {

         "storage_device" : [

            {

               "address" : "virtio:0",

               "boot_disk" : "0",

               "part_of_plan" : "yes",

               "storage" : "01799556-96ef-4d04-bf1f-1898d4b0b2bc",

               "storage_size" : 25,

               "storage_title" : "Ubuntu Server 18.04 LTS from UpCloud template",

               "type" : "disk"

            },

            {

               "address" : "virtio:1",

               "boot_disk" : "0",

               "storage" : "01b93946-5a69-44ae-8a4b-e221d119139a",

               "storage_size" : 10,

               "storage_title" : "Data disk",

               "type" : "disk"

            }

         ]

      },

      "tags" : {

         "tag" : [

            "DEV",

            "webserver"

         ]

      },

      "timezone" : "UTC",

      "title" : "Our bigger Demo Server",

      "uuid" : "00fb5e0d-4057-4a5d-bde1-abab4223f48d",

      "video_model" : "vga",

      "vnc" : "on",

      "vnc_host" : "sg-sin1.vnc.upcloud.com",

      "vnc_password" : "yourvncpassword",

      "vnc_port" : "26306",

      "zone" : "sg-sin1"

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

From API documentation,

"The server state must be stopped. Storage devices attached to the server are automatically detached and deleted. IP addresses used by the server are released."

To keep storage devices, omit the "storages=1" parameter.

"The server state must be stopped. Storage devices attached to the server are automatically detached and can be reattached to other servers. IP addresses used by the server are released."

Delete the server and the attached disks.  Server UUID is in DELETE HTTPS URL:

______________________________________________________________________________________

The server and the two attached disks have been deleted.  The backup has not been deleted.  The IP addresses have all been deleted.

Delete the backup.  UUID of backup is in DELETE HTTPS URL:

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request DELETE https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d/?storages=1

HTTP/1.1 204 No Content

Date: Mon, 02 Sep 2019 19:01:51 GMT

Server: Apache

Connection: close

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/server/00fb5e0d-4057-4a5d-bde1-abab4223f48d

HTTP/1.1 404 Not Found

Date: Mon, 02 Sep 2019 19:03:28 GMT

Server: Apache

Content-Length: 155

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "error" : {

      "error_code" : "SERVER_NOT_FOUND",

      "error_message" : "The server 00fb5e0d-4057-4a5d-bde1-abab4223f48d does not exist."

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 19:04:45 GMT

Server: Apache

Content-Length: 471

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : [

         {

            "access" : "private",

            "created" : "2019-08-31T20:13:22Z",

            "license" : 0,

            "origin" : "01b93946-5a69-44ae-8a4b-e221d119139a",

            "size" : 10,

            "state" : "online",

            "title" : "Scheduled Backup",

            "type" : "backup",

            "uuid" : "01cec459-ceb4-4ff1-aff1-ed5ab4072924",

            "zone" : "sg-sin1"

         }

      ]

   }

}

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/ip_address

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 19:06:26 GMT

Server: Apache

Content-Length: 55

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "ip_addresses" : {

      "ip_address" : []

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request DELETE https://api.upcloud.com/1.2/storage/01cec459-ceb4-4ff1-aff1-ed5ab4072924

HTTP/1.1 204 No Content

Date: Mon, 02 Sep 2019 19:29:28 GMT

Server: Apache

Connection: close

chingl@trinity:~/testing/UpCloud>

chingl@trinity:~/testing/UpCloud> curl --include --user "yourapiuser:yourapipassword" --header "Accept: application/json" --header "Content-Type: application/json" --request GET https://api.upcloud.com/1.2/storage/private

HTTP/1.1 200 OK

Date: Mon, 02 Sep 2019 19:29:34 GMT

Server: Apache

Content-Length: 48

Connection: close

Content-Type: application/json; charset=UTF-8

{

   "storages" : {

      "storage" : []

   }

}

chingl@trinity:~/testing/UpCloud>

______________________________________________________________________________________

Conclusion

The complete life cycle management of a virtual server on UpCloud has been demonstrated using UpCloud REST API.  The essential operations of server creation, adding firewall rules, manual backup, regular scheduled automatic backups, restore from backup, resize of server, tagging, deletion of server and disks, have been demonstrated.  The only useful operations that have not been shown are creating a template from a disk, cloning an existing storage and installing OS from CD-ROM.

Although the UpCloud REST API looks deceptively simple, it took me a lot longer than expected to have them to work correctly.

Only after fully understanding the actual behaviour of the UpCloud REST API, can one use programming lanuages to make the REST API calls to do infrastructure as code automation.

Sign Up for UpCloud Here and Receive USD 25 Credits

You can sign up for UpCloud service here using my referral link:

https://upcloud.com/signup/?promo=3K2NVT

REFERRAL CODE

3K2NVT

If you make at least the minimum one time payment of USD 10, you will also receive a bonus worth of USD 25 credits.

UpCloudRESTAPI ‎(Responses)‎