Open topic with navigation

# Provision cloud hosts

Available in versions: 12.56 and later

## Description

Provisions a host on the cloud.

## URL

    /Admin/rest/v1/cloud/hosts

## Remarks

Only Amazon EC2 is supported for provisioning cloud hosts using the REST API.

## HTTP Method

POST: Creates the cloud host.

## Request

Headers:

Content-Type: application/xml

Cookies:

Version 2020 (or later) | LWSSO_COOKIE_KEY={LwssoCookie};
Versions earlier than 2020 | LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie};

Request Body:

POST: An XML describing the cloud host.

This table lists the fields in the provision request (all fields are mandatory unless indicated as optional):

Element | Description
--- | ---
TemplateID | The ID of the host template. Generated automatically at the time the host template is added.
HostsAmount | The number of hosts to provision in the batch. All hosts in the batch use the same account, location, and template, and have identical configurations.
HostPurpose | The testing tools available on the host: LoadGenerator.
HostPriority | A numeric value assigned to the host. The higher the priority you give the host, the more likely the host will be allocated to a test.
SecurityGroup | A security group that allows the necessary access to your testing hosts. Security group specifies which inbound and outbound connections are permitted from the hosts, such as port 80 (HTTP) or port 3389 (RDP). Security groups are configured on your cloud provider's website, and must be created separately for each location. Only security groups configured for your selected location are displayed.
KeyPair | A key pair for which you have the private key. Key pair is used to generate the administrator password for Windows machines and to log in to Linux machines. Key pair is only relevant if you plan to remotely connect to your cloud hosts. Key pairs are managed on your cloud provider's website, and must be created separately for each location. Only key pairs configured for your selected location are displayed. Note: You must have at least one keypair to provision a host.
HostAttributes | Can contain Attribute sub elements which are used to set Host properties values. This field is optional.
Attribute | Host attribute value should contain Host Properties values as defined in LAB_PROJECT under Project Customization > Project Lists > Host Properties. You can specify multiple Attribute elements using either the default host attributes (as in the example below) or any custom attribute defined by the user.
Pools | List the IDs the appropriate host pools to which the newly provisioned cloud hosts will be added.
NotificationDate | Date to be notified if the hosts are still provisioned in the cloud provider. Hosts provisioned past this date will be listed in the cloud hosts daily digest report. This field is optional. We recommend that you enter a value for better tracking of hosts that are past there due date.
UseElasticIP | Indicates whether to use a defined a pool of predefined IP addresses with your cloud provider. Enter "1" to use elastic IPs. This field is optional.

Request Example

    POST http://<LRE_Server>/Admin/rest/v1/cloud/hosts
    Content-Type: application/xml
    Accept: application/xml
    Cookie: LWSSO_COOKIE_KEY={LwssoCookie};

    <ProvisionConfiguration>
    <CloudHosts>
      <CloudHost>
        <TemplateID>1505</TemplateID>
        <HostsAmount>1</HostsAmount>
        <HostPurpose>LoadGenerator</HostPurpose>
        <SecurityGroup>default</SecurityGroup>
        <KeyPair>12.55ImageTestingFrankfurt</KeyPair>
        <Pools>
    	<PoolID>1000</PoolID>
        </Pools>
        <HostPriority>5</HostPriority>
      </CloudHost>
      <CloudHost>
        <TemplateID>1507</TemplateID>
        <HostsAmount>1</HostsAmount>
        <HostPurpose>LoadGenerator</HostPurpose>
        <SecurityGroup>default</SecurityGroup>
        <KeyPair>12.55ImageTestingFrankfurt</KeyPair>
        <Pools>
    	<PoolID>1000</PoolID>
        </Pools>
        <HostAttributes>
    	<Attribute>Host memory:High</Attribute>
           <Attribute>Host strength:High</Attribute>
        </HostAttributes>
        <HostPriority>5</HostPriority>
        <NotificationDate>2017-09-28T14:10:43Z</NotificationDate>
      </CloudHost>
    </CloudHosts>
    </ProvisionConfiguration>

## Response

Headers:

Content-Type: application/xml or application/json

Cookies:

None

HTML Return Code:

One of the HTTP Return Codes

Upon successful deletion, returns HTTP status 200 (OK).

HTML Body:

The response body contains the request ID, and the Location header contains the URL for monitoring provisioning progress.

You can query the operations for this request ID to see the current provision status. For details, see Get all provision requests.

Response Example

    Location: http://<LRE_Server>/admin/rest/v1/Cloud/Requests/1035

    <ProvisionResponse>
        <RequestID>1035</RequestID>
    </ProvisionResponse>

## See Also

Deprovision cloud hosts
Provision host response
Get all provision requests
Get all cloud hosts
Audit cloud hosts