Getting started
The Compute service (compute.cbws.cloud) can be activated on any CBWS cloud platform project. Upon activation machines
can be spun-up via our CBWS cloud console, CBWS SDK or CBWS CLI.
Activating the service
In the cloud console go to the project in which you want to use the Compute service, then click on Compute machines.
If the Compute service has been activated you can create machines. If the Compute service hasn't been activated then the console will show a message like The Compute service is currently not enabled, to use it in your project enable it.
Click the Enable button.
The Compute service can be enabled on a project using the CBWS CLI.
- Switch to the correct project
This will return something like:
Services available for project my-project
+-----------------------------+--------------------------------+-------------------------+
| NAME | TITLE | STATE |
+-----------------------------+--------------------------------+-------------------------+
| vpc.cbws.cloud | Virtual Private Cloud | SERVICE_STATE_DISABLED |
| undercloud.cbws.cloud | Undercloud | SERVICE_STATE_DISABLED |
| iam.cbws.xyz | Identity and Access Management | SERVICE_STATE_DISABLED |
| compute.cbws.cloud | Compute service | SERVICE_STATE_DISABLED |
+-----------------------------+--------------------------------+-------------------------+
Here you can see the Compute service is still disabled.
- To enable the Compute service
Machine types
The available machine types can be listed via either the CBWS Cloud console (when creating a machine) or using the CBWS CLI.
To list the available machine types via the CBWS CLI run
This should return something like:
+----------+--------------+----------+--------+---------+--------------+
| ZONE | NAME | CPU | RAM | DISK | STOCK |
+----------+--------------+----------+--------+---------+--------------+
| nl-ein-1 | c1.1 | 1 cores | 2 GB | 20 GB | In stock |
| nl-ein-1 | g1.1 | 1 cores | 2 GB | 20 GB | Out of stock |
| nl-ein-1 | g2.1 | 1 cores | 2 GB | 20 GB | In stock |
| nl-ein-1 | g3.1 | 1 cores | 2 GB | 20 GB | In stock |
| nl-ein-1 | g4.1 | 1 cores | 2 GB | 20 GB | In stock |
| nl-ein-1 | c1.2 | 2 cores | 4 GB | 40 GB | In stock |
| nl-ein-1 | g1.2 | 2 cores | 4 GB | 40 GB | Out of stock |
| nl-ein-1 | g2.2 | 2 cores | 4 GB | 40 GB | Low stock |
| nl-ein-1 | g2.2-20G | 2 cores | 4 GB | 20 GB | In stock |
| nl-ein-1 | g3.2 | 2 cores | 4 GB | 40 GB | In stock |
| nl-ein-1 | g4.2 | 2 cores | 4 GB | 40 GB | In stock |
| nl-ein-1 | s1.4 | 2 cores | 4 GB | 80 GB | In stock |
| nl-ein-1 | c1.4 | 4 cores | 8 GB | 80 GB | In stock |
| nl-ein-1 | g1.4 | 4 cores | 8 GB | 80 GB | Out of stock |
| nl-ein-1 | g2.4 | 4 cores | 8 GB | 80 GB | Low stock |
| nl-ein-1 | g2.4-20G | 4 cores | 8 GB | 20 GB | In stock |
| nl-ein-1 | g3.4 | 4 cores | 8 GB | 80 GB | In stock |
| nl-ein-1 | g4.4 | 4 cores | 8 GB | 80 GB | |
| nl-ein-1 | s1.6 | 4 cores | 6 GB | 120 GB | In stock |
| nl-ein-1 | s1.16 | 6 cores | 16 GB | 320 GB | |
| nl-ein-1 | c1.8 | 8 cores | 16 GB | 160 GB | Low stock |
| nl-ein-1 | g1.8 | 8 cores | 16 GB | 160 GB | Out of stock |
| nl-ein-1 | g2.8 | 8 cores | 16 GB | 160 GB | Out of stock |
| nl-ein-1 | g3.8 | 8 cores | 16 GB | 160 GB | Low stock |
| nl-ein-1 | g4.8 | 8 cores | 16 GB | 160 GB | |
| nl-ein-1 | s1.24 | 8 cores | 24 GB | 480 GB | |
| nl-ein-1 | g4.12 | 12 cores | 24 GB | 240 GB | In stock |
| nl-ein-1 | s1.48 | 12 cores | 48 GB | 960 GB | In stock |
| nl-ein-1 | c1.16 | 16 cores | 32 GB | 320 GB | Low stock |
| nl-ein-1 | g2.16 | 16 cores | 32 GB | 320 GB | Out of stock |
| nl-ein-1 | g2.16-20G | 16 cores | 32 GB | 20 GB | Low stock |
| nl-ein-1 | g3.16 | 16 cores | 32 GB | 320 GB | Low stock |
| nl-ein-1 | g4.16 | 16 cores | 32 GB | 320 GB | In stock |
| nl-ein-1 | s1.64 | 16 cores | 64 GB | 1280 GB | In stock |
| nl-ein-1 | c1.24 | 24 cores | 48 GB | 480 GB | Out of stock |
| nl-ein-1 | g3.24 | 24 cores | 48 GB | 480 GB | Out of stock |
| nl-ein-1 | g4.24 | 24 cores | 48 GB | 480 GB | Low stock |
| nl-ein-1 | s1.128 | 24 cores | 128 GB | 2560 GB | |
| nl-ein-1 | c1.32 | 32 cores | 64 GB | 640 GB | Out of stock |
| nl-ein-1 | g3.32 | 32 cores | 64 GB | 640 GB | Out of stock |
| nl-ein-1 | g4.32 | 32 cores | 64 GB | 640 GB | Low stock |
+----------+--------------+----------+--------+---------+--------------+
Machines
The following section describes how to manage machines using the Compute services.
List existing machines
To list machines using the CBWS CLI:
$ cbws compute machine list
+--------------------+-----------------------------------+--------------------+-----------------+
| NAME | TYPE | HOSTNAME | ADDRESS |
+--------------------+-----------------------------------+--------------------+-----------------+
| metrics-test | zones/nl-ein-1/types/g2.1 | metrics-test | 185.142.141.132 |
+--------------------+-----------------------------------+--------------------+-----------------+
To list machines using the CBWS PHP SDK:
<?php
$nextPageToken = null;
do {
$request = ListMachinesRequest::create()
->withPageToken($nextPageToken)
->withoutState() // This is optional but will be much faster and as we don't have to check the live state of every machine
$response = $compute->listMachines($request);
foreach ($response->getMachines() as $machine) {
print_r($machine);
}
$nextPageToken = $response->getNextPageToken();
} while (!is_null($response->getNextPageToken()));
The SDK also provides a helper which can automatically paginate and yield the machines as they come in.
Creating a machine
To create a machine using the CBWS CLI:
To create a machine using the CBWS PHP SDK:
<?php
// Start the machine creation operation in the background
$operation = $compute->createMachine(
'some-machine',
Machine::create()
->withHostname('machine.example.com') // this is optional, will default to the machine name
->withType('zones/nl-ein-1/types/g2.1') // Start with G2.1 (1 core, 2 GB of RAM and 20 GB SSD) machine type in the NL-EIN-1 availability zone,
// Ensure we can recover after an error during the request, re-calling the createMachine call with the same
// idempotency key will return the result of the initial call. This is recommended but optional.
CreateMachineRequest::create()->withIdempotencyKey(Uuid::fromString('e62e7adf-9763-41aa-b2c8-2291cd035739'))
);
// Poll the operation has finished, you could also call $compute->getOperation() which does not block.
foreach ($compute->pollOperation($operation->getName()) as $operation) {
print_r($operation);
}
Deleting a machine
To delete a machine using the CBWS CLI:
To delete a machine using the CBWS PHP SDK:
<?php
// Start the machine stop operation in the background
$operation = $compute->deleteMachine(
'some-machine-identifier',
// Ensure we can recover after an error during the request, re-calling the deleteMachine call with the same
// idempotency key will return the result of the initial call. This is recommended but optional.
DeleteMachineRequest::create()->withIdempotencyKey(Uuid::fromString('e62e7adf-9763-41aa-b2c8-2291cd035739'))
);
// Poll the operation has finished, you could also call $compute->getOperation() which does not block.
foreach ($compute->pollOperation($operation->getName()) as $operation) {
print_r($operation);
}