Skip to content

Instantly share code, notes, and snippets.

@notFloran
Created April 29, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notFloran/60d6095443078eee8884 to your computer and use it in GitHub Desktop.
Save notFloran/60d6095443078eee8884 to your computer and use it in GitHub Desktop.
PHP script to create a server on Runabove with php-opencloud
<?php
require 'vendor/autoload.php';
use OpenCloud\OpenStack;
use Guzzle\Http\Exception\BadResponseException;
$client = new OpenStack('https://auth.runabove.io/v2.0/', array(
'username' => '', // email
'password' => '',
'tenantName' => '' // get it on horizon - 8 digits
));
// Region : SGB-1 - BHS-1
$service = $client->computeService('nova', 'SBG-1');
// 3. Get empty server
$server = $service->server();
// 4. Create
try {
$response = $server->create(array(
'name' => 'Test',
'imageId' => '1f3b49ad-3566-4838-93f8-b657a36b870f', // Debian 8
'flavorId' => '8f79ef0d-59ad-4792-82cd-829e0bb94f6b' // ra.intel.ha.s
));
} catch (BadResponseException $e) {
echo $e->getResponse();
}
$body = json_decode($response->getBody(true));
// THIS IS YOUR ROOT PASSWORD - DO NOT LOSE!
$password = $body->server->adminPass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment