- Notifications
You must be signed in to change notification settings - Fork0
Official command line tool for Vultr services
License
PaulSonOfLars/vultr-cli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Vultr Command Line Interface
vultr-cli is acommand line interfacefor the Vultr APIUsage: vultr-cli [command]Available Commands: account Retrieve information about your account apps Display all available applications backups Display backups bare-metal bare-metal is used to access bare metal server commands billing Display billing information block-storage block storage commands completion Generate the autocompletion scriptfor the specified shell container-registry commands to interact with container registries database Commands to interact with managed databases on vultr dns dns is used to access dns commands firewall firewall is used to access firewall commandshelp Help about anycommand instance commands to interact with instances on vultr iso iso is used to access iso commands kubernetes kubernetes is used to access kubernetes commands load-balancer load balancer commands marketplace Commands to interact with Vultr Marketplace object-storage object storage commands os os is used to access os commands plans get information about Vultr plans regions get regions reserved-ip reserved-ip lets you interact with reserved-ip script startup script commands snapshot snapshot commands ssh-key ssh-key commands user user commands version Display current version of Vultr-cli vpc Interact with VPCs vpc2 Interact with VPC 2.0 networksFlags: --config string config file (default is$HOME/.vultr-cli.yaml) (default"#HOME/.vultr-cli.yaml") -h, --helphelpfor vultr-cli -t, --toggle Help messagefor toggleUse"vultr-cli [command] --help"for more information about a command.
These are the options available to installvultr-cli
:
- Download a release from GitHub
- From source
- Package Manager
- Arch Linux
- Brew
- OpenBSD (-current)
- Snap (Coming soon)
- Chocolatey (Coming soon)
- Docker
If you are to visit thevultr-cli
releases page. You can download a compiled version ofvultr-cli
for you Linux/MacOS/Windows in 64bit.
You will need Go installed on your machine in order to work with the source (and make if you decide to pull the repo down).
go get -u github.com/vultr/vultr-cli/v3
Another way to build from source is to
git clone git@github.com:vultr/vultr-cli.git or git clone https://github.com/vultr/vultr-cli.gitcd vultr-climake builds/vultr-cli_(pass name of os + arch, as shown below)
The available make build options are
- make builds/vultr-cli_darwin_amd64
- make builds/vultr-cli_darwin_arm64
- make builds/vultr-cli_linux_386
- make builds/vultr-cli_linux_amd64
- make builds/vultr-cli_linux_arm64
- make builds/vultr-cli_windows_386.exe
- make builds/vultr-cli_windows_amd64.exe
- make builds/vultr-cli_linux_arm
Note that the latter method will install thevultr-cli
executable inbuilds/vultr-cli_(name of os + arch)
.
pacman -S vultr-cli
brew install vultr/vultr-cli/vultr-cli
dnf install vultr-cli
pkg_add vultr-cli
You can find the image onDocker Hub. To install the latest version viadocker
:
docker pull vultr/vultr-cli:latest
To pull an older image, you can pass the version string in the tag. For example:
docker pull vultr/vultr-cli:v2.15.1
The available versions are listedhere.
As described in the next section, you must authenticate in order to use the CLI. To pass the environment variable into docker, you can do so via:
docker run -e VULTR_API_KEY vultr/vultr-cli:latest instance list
This assumes you've already set the environment variable in your shell environment, otherwise, you can pass it in via-e VULTR_API_KEY=<your api key>
In order to usevultr-cli
you will need to export yourVultr API KEY
export VULTR_API_KEY=<your api key>
vultr-cli
can interact with all of your Vultr resources. Here are some basic examples to get you started:
vultr-cli instance list
vultr-cli instance create --region <region-id> --plan <plan-id> --os <os-id> --host <hostname>
vultr-cli dns domain create --domain <domain-name> --ip <ip-address>
You should use = when using a boolean flag.
vultr-cli instance create --region <region-id> --plan <plan-id> --os <os-id> --host <hostname> --notify=true
The config flag can be used to specify the vultr-cli.yaml file path when it's outside the default location (default is $HOME/.vultr-cli.yaml). If the file has theapi-key
defined, the CLI will use the vultr-cli.yaml config, otherwise it will default to reading the environment variable for the api key.
vultr-cli instance list --config /Users/myuser/vultr-cli.yaml
Currently the only available field that you can use with a config file isapi-key
. Your yaml file will have a single entry which would be:
api-key: MYKEY
vultr-cli completion
will return autocompletions, but this feature requires setup.
Some guides:
$ source <(yourprogram completion bash)To load completions for each session, execute once:Linux: $ yourprogram completion bash > /etc/bash_completion.d/yourprogrammacOS: $ yourprogram completion bash > /usr/local/etc/bash_completion.d/yourprogramIf shell completion is not already enabled in your environment, you will need to enable it. You can execute the following once: $ echo "autoload -U compinit; compinit" >> ~/.zshrcTo load completions for each session, execute once: $ yourprogram completion zsh > "${fpath[1]}/_yourprogram" You will need to start a new shell for this setup to take effect. $ yourprogram completion fish | sourceTo load completions for each session, execute once: $ yourprogram completion fish > ~/.config/fish/completions/yourprogram.fish PS> yourprogram completion powershell | Out-String | Invoke-ExpressionTo load completions for every new session, run: PS> yourprogram completion powershell > yourprogram.ps1and source this file from your PowerShell profile.
Feel free to send pull requests our way! Please see thecontributing guidelines.