Skip to content

VultrVPScreation

vultr CLI usage

first export the vultr api key

#!/usr/bin/env bash
# -------------------------------------------------
# Vultr VPS creation
# -------------------------------------------------

# Variables 
REGION="cdg"                     # Paris (CDG)
PLAN="vc2-1c-1gb"                # 1 CPU, 1 GiB RAM – 5 €/mois
OS_ID=2136                       # Debian 12 x64 (bookworm)
LABEL="pedagovps"
#HOSTNAME="pedago"
SSH_KEY="e3e03b5a-871a-41f9-bb4d-ceafa8fa1b3e"

# Exécution de la commande
vultr-cli instance create \
    --region "$REGION" \
    --plan "$PLAN" \
    --os "$OS_ID" \
    --label "$LABEL" \
    --ssh-keys "$SSH_KEY"

account information

vultr-cli account info
BALANCE     PENDING CHARGES     LAST PAYMENT DATE       LAST PAYMENT
-6.95       0.29            2025-10-06T20:10:09+00:00   -10.00

regions

vultr-cli regions list
ID  CITY        COUNTRY     CONTINENT   OPTIONS
ams Amsterdam   NL      Europe      [ddos_protection, block_storage_storage_opt, block_storage_high_perf, load_balancers, kubernetes]
cdg Paris       FR      Europe      [ddos_protection, block_storage_storage_opt, load_balancers, kubernetes]

plans

ultr-cli plans list | grep vc2-1c-1gb
vc2-1c-1gb          1       1024    25  1       1024        5.00            vc2 0               [ewr, ord, dfw, sea, lax, atl, ams, lhr, fra, sjc, syd, yto, cdg, nrt, waw, mad, icn, mia, sgp, sto, mex, mel, bom, jnb, tlv, blr, del, scl, itm, man]
vc2-1c-1gb-sc1          1       1024    25  1       1024        7.50            vc2 0               [sao]

misc

vultr-cli block-storage list
ID                  REGION ID   INSTANCE ID SIZE GB     STATUS  LABEL   BLOCK TYPE  DATE CREATED            MONTHLY COST    MOUNT ID
XXXXXd506b9 cdg             40      active  pedago  storage_opt 2025-11-17T20:04:58+00:00   $1      cdg-XXXX

backups : false by default

VPS

retrieve VPS instance ID

 vultr-cli instance list

retrieve block storage ID

vultr-cli block-storage list

attach block storage to VPS

ultr-cli block-storage attach 077d0801-25a4-4389-a6af-d597a7d506b9 --instance 6d79697e-1e92-4b2a-9167-eca24a451040 
MESSAGE
block storage has been attached

verify attached instance

vultr-cli block-storage list

ssh connect :

root@vultr:~# lsblk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sr0 11:0 1 1024M 0 rom
vda 254:0 0 25G 0 disk ├─vda1 254:1 0 512M 0 part /boot/efi └─vda2 254:2 0 24.5G 0 part / vdb 254:16 0 40G 0 disk └─vdb1 254:17 0 40G 0 part

to mount the block:

vdb1 254:17   0   40G  0 part

mkdir -p /mnt/block-storage
mount /dev/vdb1 /mnt/block-storage

to detach the block:

umount /mnt/block-storage

then

vultr-cli block-storage detach <block_id>