1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
# vultr
[](https://godoc.org/github.com/JamesClonk/vultr/lib) [](https://en.wikipedia.org/wiki/MIT_License) [](https://github.com/JamesClonk/vultr/releases) [](https://github.com/JamesClonk/vultr/releases) [](https://travis-ci.org/JamesClonk/vultr)
[Vultr](https://www.vultr.com) CLI and API client library, written in [Go](https://golang.org)
### Screenshot

Everybody likes screenshots, even of command line tools.. :smile:
### Installation
* Download the latest release for your OS: https://github.com/JamesClonk/vultr/releases
* Unzip the file
* Place the **vultr** binary somewhere into your PATH
* Export your Vultr API key into a VULTR_API_KEY env variable. You can get the API key from the [admin panel](https://my.vultr.com/settings)
```sh
$ export VULTR_API_KEY=87dFbC91rJjkL/18zJEQxS
```
* Run it
```sh
$ vultr version
Client version: 2.0.1
Vultr API endpoint: https://api.vultr.com/
Vultr API version: v1
OS/Arch (client): linux/amd64
Go version: go1.10
```
---
### Installation from source
* Install the latest version of [Go](https://golang.org)
* Make sure your GOPATH is set
* Add $GOPATH/bin to your PATH
* Use "go get" to download, compile and install the source
```sh
$ go get github.com/JamesClonk/vultr
```
* Export your Vultr API key into a VULTR_API_KEY env variable. You can get the API key from the [admin panel](https://my.vultr.com/settings)
```sh
$ export VULTR_API_KEY=89dFbb91rGjkL/12zJEQxS
```
* Run it
```sh
$ vultr version
Client version: 2.0.0
Vultr API endpoint: https://api.vultr.com/
Vultr API version: v1
OS/Arch (client): linux/amd64
Go version: go1.10
```
---
### Usage
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.
Here a some usage examples:
---
##### show help text for a command
```sh
$ vultr snapshot --help
```
```
Usage: vultr snapshot COMMAND [arg...]
modify snapshots
Commands:
create create a snapshot from an existing virtual machine
delete delete a snapshot
list list all snapshots on current account
Run 'vultr snapshot COMMAND --help' for more information on a command
```
---
##### list available plans for region
```sh
$ vultr plans -r 9
```
```
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
```
---
##### add SSH public key
```sh
$ vultr sshkey create -n sampleKey --key="$(cat ~/.ssh/id_rsa.pub)"
```
```
SSH key create success!
SSHKEYID NAME KEY
24c81f53be692 sampleKey ssh-rsa AAAB3NzaC1yc2EQABAQClpsNAM+huOB2dpxM..
```
---
##### create new virtual machine
```sh
$ vultr server create -n "test-server" -r 9 -p 29 -o 127
```
```
Virtual machine create success!
SUBID NAME DCID VPSPLANID OSID
1685097 test-server 9 29 127
```
---
##### show information about virtual machine
```sh
$ vultr server show 1685097
```
```
Id (SUBID): 1685097
Name: test-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: 2015-02-08 12:36:36
Default password: sbiecxo8yk!5
Auto backups: no
KVM URL: https://my.vultr.com/subs/vps/novnc/api.php?data=ILXS..
```
---
##### SSH into virtual machine
```sh
$ vultr ssh 1685097
```
```
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-37-generic x86_64)
* Documentation: https://help.ubuntu.com/
Last login: Thu Oct 16 21:49:35 2014 from 10.0.2.2
root@vultr:~#
```
---
|