Dedicated Hosts (DeH)

The primary resource of the DeH service is the host.

CRUD operations

List Hosts

A host is a dedicated host, where virtual machines would be running.

def list_hosts(conn):
    print("List Hosts:")

    for host in conn.deh.hosts():
        print(host)

Full example: deh host list

List Hosts Types

In order to allocate a host, it’s type need to be chosen first. Types might differ per availability zone, therefore it is required to specify in which AZ to look for types

def list_host_types(conn, az):
    print("List Host types in AZ %s:" % az)

    for host_type in conn.deh.host_types(az):
        print(host_type)

Full example: deh host list type

List Host servers

Each DeH Host is intended to run virtual instances. Only querying list of servers is supported

def list_host_servers(conn, host):
    print("List Servers running on host")

    for server in conn.deh.servers(host):
        print(server)

Full example: deh host list server

Provisioning operations

Provisioning actions are the main way to manipulate the hosts.

Allocating a DeH Host Instance

A host can be allocated with a following snip.

def create_host(conn):
    print("Create Host:")

    host = conn.deh.create_host(
        name='my_new_host',
        # host_type can be retrieved with host_types() call
        host_type='general',
        availability_zone='eu-de-01',
        # amount of hosts to allocate
        quantity=1
    )

    # dedicated_host_ids is a list of allocated hosts (since multiple may
    # be requested)

    print(host.dedicated_host_ids)

Allocating a DeH Host supports setting quantity parameter to allocate multiple hosts in a one call. Due to that the IDs of allocated hosts are being returned as part of the “virtual” resource in a dedicated_host_ids attribute

Full example: deh host create