• Stars
    star
    467
  • Rank 93,935 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official command line tool for Vultr services

vultr-cli

The Vultr Command Line Interface

vultr-cli is a command line interface for the Vultr API

Usage:
  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 script for the specified shell
  database       Commands to interact with managed databases on vultr
  dns            dns is used to access dns commands
  firewall       firewall is used to access firewall commands
  help           Help about any command
  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
  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 networks

Flags:
  --config string   config file (default is $HOME/.vultr-cli.yaml) (default "#HOME/.vultr-cli.yaml")
  -h, --help            help for vultr-cli
  -t, --toggle          Help message for toggle

Use "vultr-cli [command] --help" for more information about a command.

Installation

These are the options available to install vultr-cli:

  1. Download a release from GitHub
  2. From source
  3. Package Manager
  • Arch Linux
  • Brew
  • OpenBSD (-current)
  • Snap (Coming soon)
  • Chocolatey (Coming soon)
  1. Docker

GitHub Release

If you are to visit the vultr-cli releases page. You can download a compiled version of vultr-cli for you Linux/MacOS/Windows in 64bit.

Building from source

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/v2

Another way to build from source is to

git clone [email protected]:vultr/vultr-cli.git or git clone https://github.com/vultr/vultr-cli.git
cd vultr-cli
make 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 the vultr-cli executable in builds/vultr-cli_(name of os + arch).

Installing on Arch Linux

pacman -S vultr-cli

Installing via Brew

brew install vultr/vultr-cli/vultr-cli

Installing on Fedora

dnf install vultr-cli

Installing on OpenBSD

pkg_add vultr-cli

Docker

You can find the image on Docker Hub. To install the latest version via docker:

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 listed here.

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>

Using Vultr-cli

Authentication

In order to use vultr-cli you will need to export your Vultr API KEY

export VULTR_API_KEY=<your api key>

Examples

vultr-cli can interact with all of your Vultr resources. Here are some basic examples to get you started:

List all available instances

vultr-cli instance list

Create an instance

vultr-cli instance create --region <region-id> --plan <plan-id> --os <os-id> --host <hostname>

Create a DNS Domain

vultr-cli dns domain create --domain <domain-name> --ip <ip-address>

Utilizing a boolean flag

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

Utilizing the config flag

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 the api-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

Example vultr-cli.yaml config file

Currently the only available field that you can use with a config file is api-key. Your yaml file will have a single entry which would be:

api-key: MYKEY

CLI Autocompletion

vultr-cli completion will return autocompletions, but this feature requires setup.

Some guides:

Bash:

$ source <(yourprogram completion bash) To load completions for each session, execute once: Linux: $ yourprogram completion bash > /etc/bash_completion.d/yourprogram macOS: $ yourprogram completion bash > /usr/local/etc/bash_completion.d/yourprogram

Zsh:

If 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" >> ~/.zshrc To 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.

fish:

$ yourprogram completion fish | source To load completions for each session, execute once: $ yourprogram completion fish > ~/.config/fish/completions/yourprogram.fish

PowerShell:

PS> yourprogram completion powershell | Out-String | Invoke-Expression To load completions for every new session, run: PS> yourprogram completion powershell > yourprogram.ps1 and source this file from your PowerShell profile.

Contributing

Feel free to send pull requests our way! Please see the contributing guidelines.

More Repositories

1

govultr

Vultr Go API client
Go
228
star
2

terraform-provider-vultr

Terraform Vultr provider
Go
190
star
3

whmcs-vultr

Vultr Module for WHMCS
CSS
95
star
4

vultr-node

Vultr Node API client
JavaScript
92
star
5

terraform-vultr-condor

Kubernetes Deployment Tool for Vultr
HCL
76
star
6

vultr-cloud-controller-manager

Kubernetes Cloud Controller Manager for Vultr
Go
63
star
7

terraform-provider-vultr-community

Terraform Vultr provider
Go
50
star
8

packer-plugin-vultr

Packer Builder plugin for Vultr snapshots
Go
46
star
9

vultr-csi

Container Storage Interface (CSI) Driver for Vultr Block Storage
Go
40
star
10

docker-machine-driver-vultr

Vultr Driver Plugin for Docker Machine
Go
27
star
11

ansible-collection-vultr

Python
27
star
12

slik

Slurm in Kubernetes
Go
26
star
13

vultr-php

The Official Vultr API PHP Wrapper
PHP
20
star
14

vultr-mdtk

Vultr Markdown Toolkit
Shell
19
star
15

cert-manager-webhook-vultr

A Vultr cert-manager repo for creating an ACME DNS01 solver webhook
Go
17
star
16

archian

A fully scripted Arch installer. This is replacing the arch-scripted repo.
Shell
12
star
17

vultr-marketplace

Shell
12
star
18

vultr-docs

Code samples and support files for Vultr Docs
Shell
11
star
19

homebrew-vultr-cli

Homebrew tap for vultr-cli
Ruby
9
star
20

helm-charts

Helm charts for Vultr
Mustache
7
star
21

solution-vpc-peering

VPC Peering solutions for Vultr's infrastructure
6
star
22

vultr-python-client

An OpenAPI Python Client for Vultr
Python
5
star
23

.github

Community Files
5
star
24

api-postman-collection

Vultr API v2 Postman Collection
4
star
25

terraform-datalib-vultr

Data only module for Vultr. Maps Application, Plan, and Region human readable names to ID's.
HCL
4
star
26

crossplane-provider-vultr

Crossplane provider for Vultr
Go
4
star
27

rancher-ui-driver-vultr

Vultr options when used as a Rancher Node Template
JavaScript
3
star
28

metadata

go client for vultr metadata api
Go
3
star
29

vultr-imageless

An imageless app template for making imageless Marketplace app for Vultr
Shell
2
star
30

vultr-csharp

C#
1
star
31

archian-iso

This is the ISO builder for Archian
Shell
1
star
32

packer-vultr-condor

Pre-provisioned image for use with the Condor Terraform Module.
Shell
1
star