Working with Virtual Servers

Using the SoftLayer portal to order virtual servers is fine, but for a number of reasons it’s often more convenient to use the command line. For this, you can use SoftLayer’s command-line client to make administrative tasks quicker and easier. This page gives an intro to working with SoftLayer virtual servers using SoftLayer’s command-line client.

Note

The following assumes that the client is already configured with valid SoftLayer credentials.

First, let’s list the current virtual servers with slcli vs list.

$ slcli vs list
:.....:............:.........................:.......:........:..............:.............:....................:........:
:  id : datacenter :           host          : cores : memory :  primary_ip  :  backend_ip : active_transaction : owner  :
:.....:............:.........................:.......:........:..............:.............:....................:........:
:.....:............:.........................:.......:........:..............:.............:....................:........:

We don’t have any virtual servers yet! Let’s fix that. Before we can create a virtual server (VS), we need to know what options are available to us: RAM, CPU, operating systems, disk sizes, disk types, datacenters, and so on. Luckily, there’s a simple command to show all options: slcli vs create-options.

Some values were ommitted for brevity

$ slcli vs create-options
:................................:.................................................................................:
:                           name : value                                                                           :
:................................:.................................................................................:
:                     datacenter : ams01                                                                           :
:                                : ams03                                                                           :
:                                : wdc07                                                                           :
:             flavors (balanced) : B1_1X2X25                                                                       :
:                                : B1_1X2X25                                                                       :
:                                : B1_1X2X100                                                                      :
:                cpus (standard) : 1,2,4,8,12,16,32,56                                                             :
:               cpus (dedicated) : 1,2,4,8,16,32,56                                                                :
:          cpus (dedicated host) : 1,2,4,8,12,16,32,56                                                             :
:                         memory : 1024,2048,4096,6144,8192,12288,16384,32768,49152,65536,131072,247808            :
:        memory (dedicated host) : 1024,2048,4096,6144,8192,12288,16384,32768,49152,65536,131072,247808            :
:                    os (CENTOS) : CENTOS_5_64                                                                     :
:                                : CENTOS_LATEST_64                                                                :
:                os (CLOUDLINUX) : CLOUDLINUX_5_64                                                                 :
:                                : CLOUDLINUX_6_64                                                                 :
:                                : CLOUDLINUX_LATEST                                                               :
:                                : CLOUDLINUX_LATEST_64                                                            :
:                    os (COREOS) : COREOS_CURRENT_64                                                               :
:                                : COREOS_LATEST                                                                   :
:                                : COREOS_LATEST_64                                                                :
:                    os (DEBIAN) : DEBIAN_6_64                                                                     :
:                                : DEBIAN_LATEST_64                                                                :
:            os (OTHERUNIXLINUX) : OTHERUNIXLINUX_1_64                                                             :
:                                : OTHERUNIXLINUX_LATEST                                                           :
:                                : OTHERUNIXLINUX_LATEST_64                                                        :
:                    os (REDHAT) : REDHAT_5_64                                                                     :
:                                : REDHAT_6_64                                                                     :
:                                : REDHAT_7_64                                                                     :
:                                : REDHAT_LATEST                                                                   :
:                                : REDHAT_LATEST_64                                                                :
:                    san disk(0) : 25,100                                                                          :
:                    san disk(2) : 10,20,25,30,40,50,75,100,125,150,175,200,250,300,350,400,500,750,1000,1500,2000 :
:                  local disk(0) : 25,100                                                                          :
:                  local disk(2) : 25,100,150,200,300                                                              :
: local (dedicated host) disk(0) : 25,100                                                                          :
:           nic (dedicated host) : 100,1000                                                                        :
:................................:.................................................................................:

Here’s the command to create a 2-core virtual server with 1GiB memory, running Ubuntu 14.04 LTS, and that is billed on an hourly basis in the San Jose 1 datacenter using the command slcli vs create.

$ slcli vs create --hostname=example --domain=softlayer.com -f B1_1X2X25 -o DEBIAN_LATEST_64  --datacenter=ams01 --billing=hourly
This action will incur charges on your account. Continue? [y/N]: y
:..........:.................................:......................................:...........................:
:    ID    :               FQDN              :                 guid                 :         Order Date        :
:..........:.................................:......................................:...........................:
: 70112999 : testtesttest.test.com : 1abc7afb-9618-4835-89c9-586f3711d8ea : 2019-01-30T17:16:58-06:00 :
:..........:.................................:......................................:...........................:
:.........................................................................:
:                            OrderId: 12345678                            :
:.......:.................................................................:
:  Cost : Description                                                     :
:.......:.................................................................:
:   0.0 : Debian GNU/Linux 9.x Stretch/Stable - Minimal Install (64 bit)  :
:   0.0 : 25 GB (SAN)                                                     :
:   0.0 : Reboot / Remote Console                                         :
:   0.0 : 100 Mbps Public & Private Network Uplinks                       :
:   0.0 : 0 GB Bandwidth Allotment                                        :
:   0.0 : 1 IP Address                                                    :
:   0.0 : Host Ping and TCP Service Monitoring                            :
:   0.0 : Email and Ticket                                                :
:   0.0 : Automated Reboot from Monitoring                                :
:   0.0 : Unlimited SSL VPN Users & 1 PPTP VPN User per account           :
:   0.0 : Nessus Vulnerability Assessment & Reporting                     :
:   0.0 : 2 GB                                                            :
:   0.0 : 1 x 2.0 GHz or higher Core                                      :
: 0.000 : Total hourly cost                                               :
:.......:.................................................................:

After the last command, the virtual server is now being built. It should instantly appear in your virtual server list now.

$ slcli vs list
:.........:............:.......................:.......:........:................:..............:....................:
:    id   : datacenter :          host         : cores : memory :   primary_ip   :  backend_ip  : active_transaction :
:.........:............:.......................:.......:........:................:..............:....................:
: 1234567 :   ams01    : example.softlayer.com :   2   :   1G   : 108.168.200.11 : 10.54.80.200 :    Assign Host     :
:.........:............:.......................:.......:........:................:..............:....................:

Cool. You may ask, “It’s creating… but how do I know when it’s done?” Well, here’s how:

$ slcli vs ready 'example' --wait=600
READY

When the previous command returns, you’ll know that the virtual server has finished the provisioning process and is ready to use. This is very useful for chaining commands together.

Now that you have your virtual server, let’s get access to it. To do that, use the slcli vs detail command. From the example below, you can see that the username is ‘root’ and password is ‘ABCDEFGH’.

Warning

Be careful when using the –passwords flag. This will print the virtual server’s password on the screen. Make sure no one is looking over your shoulder. It’s also advisable to change your root password soon after creating your virtual server, or to create a user with sudo access and disable SSH-based login directly to the root account.

$ slcli vs detail example --passwords
:..............:...........................:
:         Name : Value                     :
:..............:...........................:
:           id : 1234567                   :
:     hostname : example.softlayer.com     :
:       status : Active                    :
:        state : Running                   :
:   datacenter : ams01                     :
:        cores : 2                         :
:       memory : 1G                        :
:    public_ip : 108.168.200.11            :
:   private_ip : 10.54.80.200              :
:           os : Debian                    :
: private_only : False                     :
:  private_cpu : False                     :
:      created : 2013-06-13T08:29:44-06:00 :
:     modified : 2013-06-13T08:31:57-06:00 :
:        users : root ABCDEFGH             :
:..............:...........................:

vs bandwidth

Bandwidth data over date range. Bandwidth is listed in GB

Using just a date might get you times off by 1 hour, use T00:01 to get just the specific days data Timezones can also be included with the YYYY-MM-DDTHH:mm:ss.00000-HH:mm format.

Due to some rounding and date alignment details, results here might be slightly different than results in the control portal.

Example:

slcli hw bandwidth 1234 -s 2019-05-01T00:01 -e 2019-05-02T00:00:01.00000-12:00
vs bandwidth [OPTIONS] IDENTIFIER

Options

-s, --start_date <start_date>

Start Date YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss, [required]

-e, --end_date <end_date>

End Date YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss [required]

-p, --summary_period <summary_period>

300, 600, 1800, 3600, 43200 or 86400 seconds [default: 3600]

-q, --quite_summary

Only show the summary table [default: False]

Arguments

IDENTIFIER

Required argument

If no timezone is specified, IMS local time (CST) will be assumed, which might not match your user’s selected timezone.

vs cancel

Cancel virtual servers.

vs cancel [OPTIONS] IDENTIFIER

Arguments

IDENTIFIER

Required argument

vs capture

Capture one or all disks from a virtual server to a SoftLayer image.

vs capture [OPTIONS] IDENTIFIER

Options

-n, --name <name>

Name of the image [required]

--all <all>

Capture all disks belonging to the VS

--note <note>

Add a note to be associated with the image

Arguments

IDENTIFIER

Required argument

vs create

Order/create virtual servers.

vs create [OPTIONS]

Options

-H, --hostname <hostname>

Host portion of the FQDN [required]

-D, --domain <domain>

Domain portion of the FQDN [required]

-c, --cpu <cpu>

Number of CPU cores (not available with flavors)

-m, --memory <memory>

Memory in mebibytes (not available with flavors)

-f, --flavor <flavor>

Public Virtual Server flavor key name

-d, --datacenter <datacenter>

Datacenter shortname [required]

-o, --os <os>

OS install code. Tip: you can specify <OS>_LATEST

--image <image>

Image ID. See: ‘slcli image list’ for reference

--boot-mode <boot_mode>

Specify the mode to boot the OS in. Supported modes are HVM and PV.

--billing <billing>

Billing rate [default: hourly]

Options:hourly|monthly
--dedicated, --public

Create a Dedicated Virtual Server

--host-id <host_id>

Host Id to provision a Dedicated Host Virtual Server onto

--san

Use SAN storage instead of local disk.

--test

Do not actually create the virtual server

--export <export>

Exports options to a template file

-i, --postinstall <postinstall>

Post-install script to download

-k, --key <key>

SSH keys to add to the root user (multiple occurrence permitted)

--disk <disk>

Disk sizes (multiple occurrence permitted)

--private

Forces the VS to only have access the private network

--like <like>

Use the configuration from an existing VS

-n, --network <network>

Network port speed in Mbps

-g, --tag <tag>

Tags to add to the instance (multiple occurrence permitted)

-t, --template <template>

A template file that defaults the command-line options

-u, --userdata <userdata>

User defined metadata string

-F, --userfile <userfile>

Read userdata from file

--vlan-public <vlan_public>

The ID of the public VLAN on which you want the virtual server placed

--vlan-private <vlan_private>

The ID of the private VLAN on which you want the virtual server placed

--subnet-public <subnet_public>

The ID of the public SUBNET on which you want the virtual server placed

--subnet-private <subnet_private>

The ID of the private SUBNET on which you want the virtual server placed

-S, --public-security-group <public_security_group>

Security group ID to associate with the public interface (multiple occurrence permitted)

-s, --private-security-group <private_security_group>

Security group ID to associate with the private interface (multiple occurrence permitted)

--wait <wait>

Wait until VS is finished provisioning for up to X seconds before returning

--placementgroup <placementgroup>

Placement Group name or Id to order this guest on. See: slcli vs placementgroup list

--ipv6

Adds an IPv6 address to this guest

--transient

Create a transient virtual server

vs create-options

Virtual server order options.

vs create-options [OPTIONS]

vs dns-sync

Sync DNS records.

vs dns-sync [OPTIONS] IDENTIFIER

Options

-a, --a-record

Sync the A record for the host

--aaaa-record

Sync the AAAA record for the host

--ptr

Sync the PTR record for the host

--ttl <ttl>

Sets the TTL for the A and/or PTR records [default: 7200]

Arguments

IDENTIFIER

Required argument

vs edit

Edit a virtual server’s details.

vs edit [OPTIONS] IDENTIFIER

Options

-D, --domain <domain>

Domain portion of the FQDN

-H, --hostname <hostname>

Host portion of the FQDN. example: server

-g, --tag <tag>

Tags to set or empty string to remove all

-u, --userdata <userdata>

User defined metadata string

-F, --userfile <userfile>

Read userdata from file

--public-speed <public_speed>

Public port speed.

Options:0|10|100|1000|10000
--private-speed <private_speed>

Private port speed.

Options:0|10|100|1000|10000

Arguments

IDENTIFIER

Required argument

vs list

List virtual servers.

vs list [OPTIONS]

Options

-c, --cpu <cpu>

Number of CPU cores

-D, --domain <domain>

Domain portion of the FQDN

-d, --datacenter <datacenter>

Datacenter shortname

-H, --hostname <hostname>

Host portion of the FQDN

-m, --memory <memory>

Memory in mebibytes

-n, --network <network>

Network port speed in Mbps

--hourly

Show only hourly instances

--monthly

Show only monthly instances

--transient <transient>

Filter by transient instances

--tag <tag>

Filter by tags (multiple occurrence permitted)

--sortby <sortby>

Column to sort by [default: hostname]

--columns <columns>

Columns to display. [options: guid, primary_ip, backend_ip, datacenter, action, power_state, created_by, tags] [default: id,hostname,primary_ip,backend_ip,datacenter,action]

-l, --limit <limit>

How many results to get in one api call, default is 100 [default: 100]

vs pause

Pauses an active virtual server.

vs pause [OPTIONS] IDENTIFIER

Arguments

IDENTIFIER

Required argument

vs power-on

Power on a virtual server.

vs power-on [OPTIONS] IDENTIFIER

Arguments

IDENTIFIER

Required argument

vs power-off

Power off an active virtual server.

vs power-off [OPTIONS] IDENTIFIER

Options

--hard, --soft

Perform a hard shutdown

Arguments

IDENTIFIER

Required argument

vs resume

Resumes a paused virtual server.

vs resume [OPTIONS] IDENTIFIER

Arguments

IDENTIFIER

Required argument

vs rescue

Reboot into a rescue image.

vs rescue [OPTIONS] IDENTIFIER

Arguments

IDENTIFIER

Required argument

vs reboot

Reboot an active virtual server.

vs reboot [OPTIONS] IDENTIFIER

Options

--hard, --soft

Perform a hard or soft reboot

Arguments

IDENTIFIER

Required argument

vs ready

Check if a virtual server is ready.

vs ready [OPTIONS] IDENTIFIER

Options

--wait <wait>

Seconds to wait [default: 0]

Arguments

IDENTIFIER

Required argument

vs upgrade

Upgrade a virtual server.

vs upgrade [OPTIONS] IDENTIFIER

Options

--cpu <cpu>

Number of CPU cores

--private

CPU core will be on a dedicated host server.

--memory <memory>

Memory in megabytes

--network <network>

Network port speed in Mbps

--flavor <flavor>

Flavor keyName Do not use –memory, –cpu or –private, if you are using flavors

Arguments

IDENTIFIER

Required argument

vs usage

Usage information of a virtual server.

vs usage [OPTIONS] IDENTIFIER

Options

-s, --start_date <start_date>

Start Date e.g. 2019-3-4 (yyyy-MM-dd) [required]

-e, --end_date <end_date>

End Date e.g. 2019-4-2 (yyyy-MM-dd) [required]

-t, --valid_type <valid_type>

Metric_Data_Type keyName e.g. CPU0, CPU1, MEMORY_USAGE, etc. [required]

-p, --summary_period <summary_period>

300, 600, 1800, 3600, 43200 or 86400 seconds

Arguments

IDENTIFIER

Required argument