🎉 Announcing new lower pricing — up to 40% lower costs for Cloud Servers and Cloud SQL! Read more →

Contents

Getting Started with the CLI

We have a lovely browser-based GUI for managing your Brightbox resources, but sometimes the power of a command line interface is required.

You can interact with Brightbox using our our command line interface tool, which uses our API. This guide will take you from creating a Brightbox Account to logging into your first Cloud Server via SSH.

Create an Account and OAuth Application

Firstly, sign up for a Brightbox Account.

Install the CLI

Now that you have an account, you’ll need to install our CLI software. Go do that and come back here. I’ll wait for you.

Login with the CLI

Now you have the CLI installed, use it to login with your email and password:

$ brightbox login john@example.com
Enter your password : 
The default account of acc-12345 has been selected

Notice that your account has automatically been selected as the default. If you only have one account then don’t worry. However, if you have multiple accounts or are a collaborator on another user’s account, you might want to select a specific account as your default using using the --default-account option to the login command.

Initial test

You should now be able to retrieve details of your user. Note your id as you’ll need it in a moment to set an SSH key:

$ brightbox users list

 id         name        email_address         accounts
-------------------------------------------------------
 usr-xxxxx  John Doe    john@example.com      1       
-------------------------------------------------------

Configuring your SSH key

If you didn’t provide your public SSH key when you signed up, you need to do that now so that you can log into newly created servers.

$ brightbox users update -f /home/john/.ssh/id_rsa.pub usr-xxxxx
           id: usr-xxxxx
         name: John Doe
email_address: john@example.com
     accounts: acc-12345
      ssh_key: ssh-dss AAAAB3....

Building your first server

Choose an image

First, let’s choose an operating system Image to use:

$ brightbox images

id         owner      type      created_on  status   size   name                                                     
---------------------------------------------------------------------------------------------------------------
 img-hy0lf  brightbox  official  2013-05-10  public   0      Blank Disk Image (i686)                                  
 img-t3xyp  brightbox  official  2013-05-10  public   0      Blank Disk Image (x86_64)                                
 img-adtke  brightbox  official  2011-07-20  public   0      Blank Disk Image (compat) (i686)                         
 img-ztdma  brightbox  official  2011-07-20  public   0      Blank Disk Image (compat) (x86_64)                       
 img-8uks9  brightbox  official  2020-04-29  public   2      Brightbox Bootstaller (x86_64)                           
 img-6lzq5  brightbox  official  2019-08-10  public   8192   CentOS-6-x86_64-server (x86_64)                          
 img-mridq  brightbox  official  2020-04-28  public   8192   CentOS-7-x86_64-server (x86_64)                          
 img-5p8nt  brightbox  official  2021-06-09  public   10240  CentOS-8-x86_64-server (x86_64)                          
 img-w1c9b  brightbox  official  2020-10-29  public   4096   Fedora-33-x86_64-server (x86_64)                         
 img-lqlqq  brightbox  official  2021-04-28  public   5120   Fedora-34-x86_64-server (x86_64)                         
 img-l60i2  brightbox  official  2021-06-09  public   5121   FreeBSD-11-amd64-server (x86_64)                         
 img-mrzzf  brightbox  official  2021-06-09  public   5121   FreeBSD-11-i386-server (i686)                            
 img-g8byj  brightbox  official  2021-06-09  public   5121   FreeBSD-12-amd64-server (x86_64)                         
 img-axudr  brightbox  official  2021-06-09  public   5121   FreeBSD-12-i386-server (i686)                            
 img-ikdu0  brightbox  official  2021-04-13  public   5153   FreeBSD-13-amd64-server (x86_64)                         
 img-i7rn5  brightbox  official  2021-04-13  public   5153   FreeBSD-13-i386-server (i686)                            
 img-jojo6  brightbox  official  2017-08-02  public   20480  Windows 2008 Server R2 (x86_64)                          
 img-hj5x9  brightbox  official  2021-08-17  public   20480  Windows Server 2019 Standard (x86_64)                    
 img-hphf5  brightbox  official  2021-08-28  public   2048   debian-10-amd64-server (x86_64)                          
 img-ipy3j  brightbox  official  2021-07-23  public   2048   debian-9-amd64-server (x86_64)                           
 img-ciz3j  brightbox  official  2021-05-06  public   10240  fedora-coreos-33-x86_64-server (x86_64)                  
 img-nj52f  brightbox  official  2021-08-11  public   10240  fedora-coreos-34-x86_64-server (x86_64)                  
 img-w5ge5  brightbox  official  2021-09-01  public   2252   ubuntu-bionic-18.04-amd64-server (x86_64)                
 img-r7ja0  brightbox  official  2021-09-01  public   2252   ubuntu-bionic-18.04-i386-server (i686)                   
 img-s9k5c  brightbox  official  2021-08-27  public   2252   ubuntu-focal-20.04-amd64-server (x86_64)                 
 img-axhjp  brightbox  official  2021-08-18  public   2252   ubuntu-hirsute-21.04-amd64-server (x86_64)               
 img-jtxtg  brightbox  official  2021-04-30  public   2252   ubuntu-xenial-16.04-amd64-server (x86_64)                
 img-62z37  brightbox  official  2021-04-30  public   2252   ubuntu-xenial-16.04-amd64-server-uefi1 (x86_64)          
 img-2qqwz  brightbox  official  2021-04-30  public   2252   ubuntu-xenial-16.04-i386-server (i686)                   
---------------------------------------------------------------------------------------------------------------

Let’s use ubuntu-focal-20.04-amd64-server, which is has an identifier of img-s9k5c. We can inspect the details of the image using brightbox images show. The username field shows that the default account is named ubuntu.

$ brightbox images show img-s9k5c

                id: img-s9k5c
              type: official
             owner: brightbox
        created_at: 2021-08-27T06:57Z
            status: public
            locked: false
              arch: x86_64
              name: ubuntu-focal-20.04-amd64-server (x86_64)
       description: ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:20.04:amd64/20210825/...
          username: ubuntu
      virtual_size: 2252
         disk_size: 649
            public: true
compatibility_mode: false
          official: true
       ancestor_id: 
      licence_name:

Create the server

Now you can create a server using that image. Give it a name of my first server so you can identify it easily later:

$ brightbox servers create -n "my first server" img-s9k5c

Creating a 1gb.ssd (typ-w0hf9) server with image ubuntu-focal-20.04-amd64-server (img-s9k5c)

 id         status    type     zone   created_on  image_id   cloud_ips  name           
----------------------------------------------------------------------------------------
 srv-zx1hd  creating  1gb.ssd  gb1-b  2021-08-29  img-s9k5c             my first server
----------------------------------------------------------------------------------------

Note that the new server has been given the identifier srv-zx1hd.

If you wait a few moments and show the details of the new server, it should have changed status from creating to active, which means it has been built and has started up:

$ brightbox servers show srv-zx1hd
    
             id: srv-zx1hd
         status: active
         locked: false
           name: my first server
     created_at: 2021-08-29T00:24
     deleted_at: 
           zone: gb1-a
           type: typ-w0hf9
      type_name: SSD 1GB
    type_handle: 1gb.ssd
            ram: 1024
          cores: 1
           disk: 30720
          image: img-s9k5c
     image_name: ubuntu-focal-20.04-amd64-server
    private_ips: 10.146.19.166
      cloud_ips: 
   ipv6_address: 2a02:1348:14c:4f3:24:19ff:fef0:13ce
   cloud_ip_ids:
       hostname: srv-zk1hd
           fqdn: srv-zk1hd.gb1.brightbox.com
public_hostname: 
  ipv6_hostname: ipv6.srv-zk1hd.gb1.brightbox.com
      snapshots: 
  server_groups: grp-98v4n

Mapping a Cloud IP

So now you have a server with a IPv6 address and a private IPv4 address. You can reach it straight away if you have an IPv6 Internet connection:

$ ping6 ipv6.srv-zx1hd.gb1.brightbox.com

PING ipv6.srv-zx1hd.gb1.brightbox.com(2a02:1348:14c:4f3:24:19ff:fef0:13ce) 56 data bytes
64 bytes from 2a02:1348:14c:4f3:24:19ff:fef0:13ce: icmp_seq=1 ttl=54 time=13.8 ms

--- ipv6.srv-qdhro.gb1.brightbox.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 13.876/13.876/13.876/0.000 ms

To give it a public IPv4 address, you need to map a Cloud IP to it. Firstly, create a Cloud IP on your account:

$ brightbox cloudips create

 id         status    public_ip      destination  reverse_dns                          name
--------------------------------------------------------------------------------------------
 cip-360ea  unmapped  109.107.37.80               cip-109-107-37-80.gb1.brightbox.com      
--------------------------------------------------------------------------------------------

Then map it to your server using the Cloud IP identifier and your server identifier:

$ brightbox cloudips map cip-360ea srv-zx1hd

Mapping cip-360ea to interface int-x4kve on srv-zx1hd


 id         status  public_ip      destination  reverse_dns                          name
------------------------------------------------------------------------------------------
 cip-360ea  mapped  109.107.37.80  srv-zx1hd    cip-109-107-37-80.gb1.brightbox.com      
------------------------------------------------------------------------------------------

Now you can log in via SSH using your ssh key. Remember, this image uses the ubuntu account by default:

$ ssh ubuntu@109.107.37.80
Welcome to Ubuntu 18.04 LTS (GNU/Linux)

ubuntu@srv-zx1hd:~$ uptime
 13:02:07 up  0:01,  1 user,  load average: 0.04, 0.01, 0.00

For convenience, there is also a DNS entry for the first Cloud IP mapped to a server:

$ host public.srv-zx1hd.gb1.brightbox.com

public.srv-zx1hd.gb1.brightbox.com has address 109.107.37.80

Would you like to know more?

Here you installed and configured the Command Line Interface tool, created an Ubuntu server, mapped a Cloud IP to it and connected in using ssh.

You might want to learn more about Cloud IPs, discover zones or learn how to Create a snapshot.

You’ll also need to know about server types so you can build servers with different specs. See the brightbox types command for a list.

You might also want to learn a bit about the default firewall policy, and how to change it.

If you want to automate use of the CLI you may want to look into authenticating with an API client, rather than your user credentials.

Last updated: 03 Sep 2021 at 13:22 UTC

Try Brightbox risk-free with ÂŁ50 free credit Sign up takes just two minutes...