Using the Command-Line Tools - Working Example

Each command corresponds to a single API HTTP GET or POST, with the URL corresponding to the command-line arguments, and the input and output data exactly as seen on the command line here.

1. Set API end-point for your availability zone

Substitute api-jhb1.go2cloud.co.za if your account is there. Alternatively, you can hard-code the value of G2CURI in your local copy of the scripts.

      $ export G2CURI=https://api-jhb1.go2cloud.co.za/

2. Set authentication credentials (from account profile)

Omit the secret key if you are running on a very old Unix system that leaks the content of your environment to other users via ps e. You will then be interactively prompted for your secret key by curl. Alternatively, you can hard-code the value of G2CAUTH in your local copy of the scripts, but make sure they aren’t world-readable!

      $ export G2CAUTH=<user uuid>:<secret API key>

3. Create drive and upload image

We use the drive upload tool to automatically upload in gzipped chunks.

      $ go2cloud-upload image.raw
      Created drive 08c92dd5-70a0-4f51-83d2-835919d254df of size 10000000
      Uploading 2 chunks of 5242880 bytes: .. completed

NOTE: for reference, a more basic upload with the raw API would be:

      $ go2cloud -c drives create << EOF | grep drive
      $ > name TestDrive
      $ > size 10000000
      $ > EOF
      $ drive 08c92dd5-70a0-4f51-83d2-835919d254df
      $ go2cloud -f image.raw drives 08c92dd5-70a0-4f51-83d2-835919d254df write

 4. Boot a server from the drive Boot a server from the drive, with 2000 core MHz and 1024 MB RAM.

      $ go2cloud -c servers create << EOF
      > name TestServer
      > cpu 2000
      > mem 1024
      > ide:0:0 08c92dd5-70a0-4f51-83d2-835919d254df
      > boot ide:0:0
      > nic:0:model e1000
      > nic:0:dhcp auto
      > smp auto
      > vnc auto
      > password XXXXXXXX
      > EOF
      server 85ef58c8-6f5d-4f7f-8f1c-0c19d45d7c1c
      name TestServer
      cpu 2000
      smp auto
      smp:cores 1
      smp:sockets 1
      mem 1024
      ide:0:0 08c92dd5-70a0-4f51-83d2-835919d254df
      boot ide:0:0
      nic:0:dhcp auto
      nic:0:dhcp:ip 91.203.56.132
      nic:0:model e1000
      rx 0
      tx 0
      vnc auto
      vnc:ip 41.79.111.100
      password XXXXXXXX

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk