Skip to content
Go to file
Cannot retrieve contributors at this time
82 lines (58 sloc) 1.6 KB

Getting started: the compute service

The CloudAtCost UI is pretty terrible,its slow and it stops working most of the time.Moreover you cannot customize the machines.This is where the fog comes to play.

To use fog

You'll need a CloudAtCost account and an API token to use this provider.

Get one from

Click on the settings button in menu. Make sure you add your ip to the allowed ip field.

Write down the API Token.

Connecting, retrieving and managing server objects

First, create a connection to the host:

require 'fog'

cac ={
  :provider  => 'CloudAtCost',
  :email     => '', # Your email address
  :api_key   => 'poiuweoruwoeiuroiwuer', # your API Token   

Listing servers

Listing servers and attributes:

cac do |server|
  puts server.ip
  puts server.servername
  puts server.vmname
  puts server.mode
  puts server.label

Server creation and life-cycle management

Creating a new server :

server = cac.servers.create :cpu => 'foobar', # 1, 2, 4 
                            :ram  => 1024, # multiple of 4 min 512
                            :storage => 10, # 10G
                            :template_id => 75 #Template id

The server is automatically started after that.

As you can see you need the template_id to create the server:

cac.templates.each do |image|
  puts image.detail

Power off a server:

server = cac.servers.first

Power on a server:


Destroying the server:

You can’t perform that action at this time.