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 : 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 :
:..............:...........................:
virtual 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 vs bandwidth 1234 -s 2019-05-01T00:01 -e 2019-05-02T00:00:01.00000-12:00
virtual bandwidth [OPTIONS] IDENTIFIER
Options
- -s, --start_date <start_date>
Required Start Date YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss,
- -e, --end_date <end_date>
Required End Date YYYY-MM-DD, YYYY-MM-DDTHH:mm:ss
- -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.
virtual cancel
Cancel virtual servers.
virtual cancel [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual capture
Capture one or all disks from a virtual server to a SoftLayer image.
virtual capture [OPTIONS] IDENTIFIER
Options
- -n, --name <name>
Required Name of the image
- --all
Capture all disks belonging to the VS
- --note <note>
Add a note to be associated with the image
Arguments
- IDENTIFIER
Required argument
virtual create
Order/create virtual servers.
virtual create [OPTIONS]
Options
- -H, --hostname <hostname>
Required Host portion of the FQDN
- -D, --domain <domain>
Required Domain portion of the FQDN
- -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>
Required Datacenter shortname
- -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
- --router-public <router_public>
The ID of the public ROUTER on which you want the virtual server placed
- --router-private <router_private>
The ID of the private ROUTER 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
See ‘slcli vs create-options’ for valid options
virtual create-options
Virtual server order options.
virtual create-options [OPTIONS] [LOCATION]
Options
- --vsi-type <vsi_type>
VS keyName type.
- Default:
'PUBLIC_CLOUD_SERVER'
- Options:
PUBLIC_CLOUD_SERVER | TRANSIENT_CLOUD_SERVER | SUSPEND_CLOUD_SERVER | CLOUD_SERVER
- -p, --prices
Use –prices to list the server item prices, and to list the Item Prices by location,add it to the –prices option using location short name, e.g. –prices dal13
Arguments
- LOCATION
Optional argument
virtual dns-sync
Sync DNS records.
virtual 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
If you don’t specify any arguments, it will attempt to update both the A and PTR records. If you don’t want to update both records, you may use the -a or –ptr arguments to limit the records updated.
virtual edit
Edit a virtual server’s details.
virtual 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
virtual list
List virtual servers.
virtual 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
- -t, --tag <tag>
list of tags
- --transient <transient>
Filter by transient instances
- --search <search>
Use the more flexible Search API to list instances. See slcli search –types for list of searchable fields.
- --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, createDate]
- Default:
'id,hostname,domain,deviceStatus.name,datacenter,primary_ip,backend_ip,createDate,action'
- -l, --limit <limit>
How many results to get in one api call, default is 100
- Default:
100
virtual pause
Pauses an active virtual server.
virtual pause [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual power-on
Power on a virtual server.
virtual power-on [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual power-off
Power off an active virtual server.
virtual power-off [OPTIONS] IDENTIFIER
Options
- --hard, --soft
Perform a hard shutdown
Arguments
- IDENTIFIER
Required argument
virtual resume
Resumes a paused virtual server.
virtual resume [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual rescue
Reboot into a rescue image.
virtual rescue [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual reboot
Reboot an active virtual server.
virtual reboot [OPTIONS] IDENTIFIER
Options
- --hard, --soft
Perform a hard or soft reboot
Arguments
- IDENTIFIER
Required argument
virtual ready
Check if a virtual server is ready.
virtual ready [OPTIONS] IDENTIFIER
Options
- --wait <wait>
Seconds to wait
- Default:
0
Arguments
- IDENTIFIER
Required argument
virtual upgrade
Upgrade a virtual server.
virtual 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
- --add-disk <add_disk>
add Hard disk in GB
- --resize-disk <resize_disk>
Update disk number to size in GB. –resize-disk 250 2
- --flavor <flavor>
Flavor keyName Do not use –memory, –cpu or –private, if you are using flavors
Arguments
- IDENTIFIER
Required argument
Note: SoftLayer automatically reboots the VS once upgrade request is placed. The VS is halted until the Upgrade transaction is completed. However for Network, no reboot is required.
virtual usage
Usage information of a virtual server.
virtual usage [OPTIONS] IDENTIFIER
Options
- -s, --start_date <start_date>
Required Start Date e.g. 2019-3-4 (yyyy-MM-dd)
- -e, --end_date <end_date>
Required End Date e.g. 2019-4-2 (yyyy-MM-dd)
- -t, --valid_type <valid_type>
Required Metric_Data_Type keyName e.g. CPU0, CPU1, MEMORY_USAGE, etc.
- -p, --summary_period <summary_period>
300, 600, 1800, 3600, 43200 or 86400 seconds
Arguments
- IDENTIFIER
Required argument
virtual storage
Get storage details for a virtual server.
virtual storage [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual billing
Get billing for a virtual device.
virtual billing [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual detail
Get details for a virtual server.
virtual detail [OPTIONS] IDENTIFIER
Options
- --passwords
Show passwords (check over your shoulder!)
- --price
Show associated prices
Arguments
- IDENTIFIER
Required argument
virtual reload
Reload operating system on a virtual server.
virtual reload [OPTIONS] IDENTIFIER
Options
- -i, --postinstall <postinstall>
Post-install script to download
- --image <image>
Image ID. The default is to use the current operating system. See: ‘slcli image list’ for reference
- -k, --key <key>
SSH keys to add to the root user (multiple occurrence permitted)
Arguments
- IDENTIFIER
Required argument
virtual credentials
List virtual server credentials.
virtual credentials [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual migrate
Manage VSIs that require migration. Can migrate Dedicated Host VSIs as well.
virtual migrate [OPTIONS]
Options
- -g, --guest <guest>
Guest ID to immediately migrate.
- -a, --all
Migrate ALL guests that require migration immediately.
- -h, --host <host>
Dedicated Host ID to migrate to. Only works on guests that are already on a dedicated host.
virtual monitoring
Get details for a vsi monitors device.
virtual monitoring [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual access
Get user access details a virtual server.
virtual access [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual notifications
Get all VS notifications.
virtual notifications [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual notification-add
Create a user virtual notification entry.
virtual notification-add [OPTIONS] IDENTIFIER
Options
- --users <users>
UserId to be notified on monitoring failure.
Arguments
- IDENTIFIER
Required argument
virtual notification-delete
Remove a user VS notification entry.
virtual notification-delete [OPTIONS] IDENTIFIER
Arguments
- IDENTIFIER
Required argument
virtual host-list
List dedicated host.
virtual host-list [OPTIONS]
Options
- --tag <tag>
Filter by tags (multiple occurrence permitted)
- --sortby <sortby>
Column to sort by
- Default:
'Name'
- -d, --datacenter <datacenter>
Filter by datacenter shortname
- -H, --name <name>
Filter by host portion of the FQDN
- --order <order>
Filter by ID of the order which purchased this dedicated host
- --owner <owner>
Filter by owner of the dedicated host
virtual host-create
Order/create a dedicated host.
virtual host-create [OPTIONS]
Options
- -H, --hostname <hostname>
Required Host portion of the FQDN
- -r, --router <router>
Router hostname ex. fcr02a.dal13
- -D, --domain <domain>
Required Domain portion of the FQDN
- -d, --datacenter <datacenter>
Required Datacenter shortname
- -f, --flavor <flavor>
Required Dedicated Virtual Host flavor
- --billing <billing>
Billing rate
- Default:
'hourly'
- Options:
hourly | monthly
- --verify
Verify dedicatedhost without creating it.
- -t, --template <template>
A template file that defaults the command-line options
- --export <export>
Exports options to a template file
See ‘slcli dedicatedhost create-options’ for valid options.
virtual os-available
Get all available Operating Systems.
virtual os-available [OPTIONS]
Manages the migration of virutal guests. Supports migrating virtual guests on Dedicated Hosts as well.