Bandwidth in Vultr is…complicated.
Here’s how it works:
- Every month you get a dollop of free bandwidth, spread across your VMs. Presently it’s 2TB.
- Then you get per-instance bandwidth. This is allocated to each instance, but you don’t get it all at once. You get 1/672nd of the hourly spec for that VM every hour.
- Coming Soontm you will be able to also purchase additional bandwidth.
The reason for these complications is that Vultr is selling bandwidth on a per-hour basis. They don’t want someone firing up an instance, burning 1TB of bandwidth, then shutting it down and immediately starting a new VM with a new 1TB of bandwidth, etc. On the other hand, someone might need to use more of their allocation early in the month and could run ahead of the 1/672nd, so they have an overall free allocation as well.
And When You Go Over, the Meter Starts
If you exceed your bandwidth (total of free bandwidth and instance bandwidth), Vultr will start charging you at $.01 per GB. That’s not a bad price compared to some people (<cough> AWS <cough>) but still real money at $10/TB.
You should monitor how much bandwidth you’re using. But how? You can login to the Vultr panel, and there is a Bandwidth Usage report.
Of course, that means remembering to login and check it.
Much better would be something you can script. Here’s a quick piece of code that lets you query the Vultr API to get your bandwidth stats. You’ll need an API key (go to the panel and look under…you guessed it…API).
You’ll also need jq, which is a JSON pretty-printer/extractor your favorite package manager can install for you with something like
apt install jq
Vultr’s API returns data in JSON format, and we use jq to pull data out of the results.
#!/bin/bash VULTR_API_KEY=ABC123DEF456GHI789 # replace DATA=$(curl -s "https://api.vultr.com/v2/account/bandwidth" \ -X GET \ -H "Authorization: Bearer ${VULTR_API_KEY}") IBC=$( echo $DATA | jq .bandwidth.currentMonthToDate.instanceBandwidthCredits ) FBC=$( echo $DATA | jq .bandwidth.currentMonthToDate.freeBandwidthCredits ) GB_OUT=$( echo $DATA | jq .bandwidth.currentMonthToDate.gb_out ) TOT_CREDIT=$(( IBC + FBC )) AVAIL=$(( TOT_CREDIT - GB_OUT )) printf "Total BW credits: %d\n" $TOT_CREDIT printf "Total BW used : %d\n" $GB_OUT printf "Total BW avail : %d\n" $AVAIL
If you want an email alert, try adding this at the bottom:
if [ $AVAIL -lt 100 ] ; then echo "Vultr bandwidth low! $AVAIL out of $TOT_CREDIT left" | mailx -s "Vultr bandwidth alert" your@email.com fi
Stick it in cron and you’ll get alerted when your remaining bandwidth is less than 100GB.
Related Posts:
Vultr Welcomes AMD Instinct MI300X Accelerators to Enhance Its Cloud Platform
Vultr Partners with SQream to Enhance Data Analytics through GPU Acceleration and Improved Scalabili...
Do You Get Downtime Notifications? Reason for Outage Explanations? If Not, You May Need a New Provi...
Let's Try BSD, Part 7 of 7: Conclusions About FreeBSD, OpenBSD, NetBSD, and DragonFlyBSD
Let's Try BSD, Part 6 of 7: Jump Into the Unknown With Me As I Install DragonFlyBSD!
Let's Try BSD, Part 5 of 7: Setting Up Nginx + WordPress on OpenBSD! Almost!
- We Called It Wrong: Ross Ulbricht, Who Masterminded Multiple Attempted Murders, Has Been Pardoned - January 22, 2025
- Perfectionists Welcome!The PQ Hosting Interview (with a Special Discount Code!) - January 21, 2025
- Dropbear in 2025: Still the LowEnd SSH Server of Choice? - January 20, 2025
Leave a Reply