Vultr: Difference between revisions
From wikinotes
(→API) |
(→API) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
vultr is another cloud provider, like [[digitalocean]].<br> | vultr is another cloud provider, like [[digitalocean]].<br> | ||
it has a wider range of supported OS's, | it has a wider range of supported OS's, cheaper rates, even hosts windows if needed for CI. | ||
= Documentation = | = Documentation = | ||
Line 15: | Line 15: | ||
= API = | = API = | ||
<blockquote> | <blockquote> | ||
{{ NOTE | | |||
not all plans are exposed to API (notably cheapest are not) }} | |||
list instances | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
curl "https://api.vultr.com/v2/instances" \ | curl "https://api.vultr.com/v2/instances" \ | ||
Line 21: | Line 25: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
get info to create an instance | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
curl "https://api.vultr.com/v2/os" | jq | less | curl "https://api.vultr.com/v2/os" | jq | less | ||
curl "https://api.vultr.com/v2/regions" | jq | less | curl "https://api.vultr.com/v2/regions" | jq | less | ||
curl "https://api.vultr.com/v2/ssh-keys" | jq | less | |||
curl "https://api.vultr.com/v2/plans" | jq | grep -e '"id":' -e '"monthly_cost"' | sed 'N;s/\n/ /' | sort -g -k 4,4 | less | curl "https://api.vultr.com/v2/plans" | jq | grep -e '"id":' -e '"monthly_cost"' | sed 'N;s/\n/ /' | sort -g -k 4,4 | less | ||
</syntaxhighlight> | </syntaxhighlight> | ||
create an instance | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
curl "https://api.vultr.com/v2/instances" \ | curl "https://api.vultr.com/v2/instances" \ | ||
-X POST \ | -X POST \ | ||
-H "Authorization: Bearer ${API_KEY}" \ | -H "Authorization: Bearer ${API_KEY}" \ | ||
-d | -d '{ | ||
{ | |||
"region": "ewr", | "region": "ewr", | ||
"plan": "vc2-6c-16gb", | "plan": "vc2-6c-16gb", | ||
Line 44: | Line 46: | ||
"backups": "enabled", | "backups": "enabled", | ||
"hostname": "my_hostname" | "hostname": "my_hostname" | ||
} | }' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- API --> | </blockquote><!-- API --> |
Latest revision as of 21:30, 25 September 2022
vultr is another cloud provider, like digitalocean.
it has a wider range of supported OS's, cheaper rates, even hosts windows if needed for CI.
Documentation
home https://www.vultr.com/ api https://www.vultr.com/api/
API
NOTE:
not all plans are exposed to API (notably cheapest are not)
list instances
curl "https://api.vultr.com/v2/instances" \ -X GET \ -H "Authorization: Bearer ${API_KEY}"get info to create an instance
curl "https://api.vultr.com/v2/os" | jq | less curl "https://api.vultr.com/v2/regions" | jq | less curl "https://api.vultr.com/v2/ssh-keys" | jq | less curl "https://api.vultr.com/v2/plans" | jq | grep -e '"id":' -e '"monthly_cost"' | sed 'N;s/\n/ /' | sort -g -k 4,4 | lesscreate an instance
curl "https://api.vultr.com/v2/instances" \ -X POST \ -H "Authorization: Bearer ${API_KEY}" \ -d '{ "region": "ewr", "plan": "vc2-6c-16gb", "label": "Example Instance", "os_id": 215, "user_data": "QmFzZTY0IEV4YW1wbGUgRGF0YQ==", "backups": "enabled", "hostname": "my_hostname" }'