Sha256: 1ab76d9b3ec314a87fe7cc7f9e3bbe2698e5952c486290e1ba90208fe6c6d938

Contents?: true

Size: 1.6 KB

Versions: 11

Compression:

Stored size: 1.6 KB

Contents

# 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 https://panel.cloudatcost.com.

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:

```ruby
require 'fog'

cac = Fog::Compute.new({
  :provider  => 'CloudAtCost',
  :email     => 'example@email.com', # Your email address
  :api_key   => 'poiuweoruwoeiuroiwuer', # your API Token   
})
```

## Listing servers

Listing servers and attributes:

```ruby
cac do |server|
  puts server.ip
  puts server.servername
  puts server.vmname
  puts server.mode
  puts server.label
end
```

## Server creation and life-cycle management

Creating a new server :

```ruby
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:

```ruby
cac.templates.each do |image|
  puts image.id
  puts image.detail
end
```

Power off a server:

```ruby
server = cac.servers.first
server.power_off
```

Power on a server:

```ruby
server.power_on
```

Destroying the server:

```ruby
server.destroy
```

Version data entries

11 entries across 9 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-cloudatcost-0.1.2/lib/fog/cloudatcost/examples/getting_started.md
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-cloudatcost-0.1.2/lib/fog/cloudatcost/examples/getting_started.md
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-cloudatcost-0.1.2/lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.4.0 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.2.3 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.2.2 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.2.1 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.2.0 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.1.2 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.1.1 lib/fog/cloudatcost/examples/getting_started.md
fog-cloudatcost-0.1.0 lib/fog/cloudatcost/examples/getting_started.md