Vultr CLI is a command line tool for using the Vultr API. It allows you to create and manage your virtual machines, SSH public keys, snapshots and startup scripts on your Vultr account. You can also use it to directly SSH into a Vultr virtual machine through the vultr ssh command.
This tutorial assumes that you have access to an Centos 7 system, configured with a non-root user with sudo privileges as described in Initial Setup of a CentOS 7 Server.
Visit the official Go downloads page and find the URL for the current binary release's tarball, and make sure you're in your home directory, and use curl
to retrieve the tarball:
cd ~
curl -O https://dl.google.com/go/go1.11.2.linux-amd64.tar.gz
Once the download is completed verify the tarball checksum with the sha256sum
command:
sha256sum go1.11.2.linux-amd64.tar.gz
Compare the hash in your output to the checksum value on the Go download page.
be2a9382ef85792280951a78e789e8891ddb1df4ac718cd241ea9d977c85c683 go1.11.2.linux-amd64.tar.gz
Next, extract the tarball to the /usr/local
directory:
sudo tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
Open the etc/profile
file using your favorite text editor, in this tutorial i will use nano
for its simplicity:
sudo nano etc/profile
Append the following line:
export PATH=$PATH:/usr/local/go/bin
Save and close the file.
To apply the changes, use the source
command to reload the updated profiles:
source ~/.bash_profile
Compile and install the source using go get
:
go get github.com/JamesClonk/vultr
Export your Vultr API key into a VULTR_API_KEY
env variable:
export VULTR_API_KEY=YOUR_API_KEY
You can get your API key from the members area (Account → Settings API).
Confirm that you have installed Vultr CLI correctly by running the following command:
vultr version
The output will look something like this:
Client version: 1.15.0
Vultr API endpoint: https://api.vultr.com/
Vultr API version: v1
OS/Arch (client): linux/amd64
Go version: go1.11.2
You are ready now to create and manage your virtual machines, SSH public keys, snapshots and startup scripts on your command line interface.
List available plans for region:
vultr plans -r 9
Output:
VPSPLANID NAME VCPU RAM DISK BANDWIDTH PRICE
30 1024 MB RAM,20 GB SSD,2.00 TB BW 1 1024 20 2.00 7.00
29 768 MB RAM,15 GB SSD,1.00 TB BW 1 768 15 1.00 5.00
3 2048 MB RAM,40 GB SSD,3.00 TB BW 2 2048 40 3.00 15.00
28 8192 MB RAM,120 GB SSD,5.00 TB BW 4 8192 120 5.00 70.00
27 4096 MB RAM,65 GB SSD,4.00 TB BW 2 4096 65 4.00 35.00
Create a new virtual machine:
vultr server create -n "nodejs-server" -r 9 -p 29 -o 127
Output:
Virtual machine create success!
SUBID NAME DCID VPSPLANID OSID
1685089 nodejs-server 9 29 127
Show information about virtual machine:
vultr server show 1685089
Output:
Id (SUBID): 1685089
Name: nodejs-server
Operating system: CentOS 6 x64
Status: active
Power status: running
Location: Frankfurt
Region (DCID): 9
VCPU count: 1
RAM: 768 MB
Disk: Virtual 15 GB
Allowed bandwidth: 1000
Current bandwidth: 0
Cost per month: 5.00
Pending charges: 0.01
Plan (VPSPLANID): 29
IP: 107.62.131.240
Netmask: 255.255.254.0
Gateway: 107.62.131.1
Internal IP:
#1 IPv6 IP:
#1 IPv6 Network: ::
#1 IPv6 Network Size: 0
Created date: 2018-10-08 12:36:36
Default password: sbiecxo8yk!5
Auto backups: no
KVM URL: https://my.vultr.com/subs/vps/novnc/api.php?data=ILXS..