In DO there are four types of droplets: Standard, General Purpose, CPU Optimized, and Memory Optimized droplet.
Is it possible to create and delete “General Purpose” droplet via API? If yes, are there samples on how to do it?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Adding a bit to @alexdo’s answer, when you create a Droplet via the API, you will supply a “size slug.” Size slugs are human-readable strings used to specify the type of Droplet in certain API requests. They are comprised of the identifier for the Droplet’s class, the vCPU count, and the amount of RAM. For example, the $5 per month Standard Droplet comes with 1 vCPU and 1 GB of RAM. So its size slug is:
s-1vcpu-1gb
Size slugs for General Purpose Droplets are prefixed with
g-
So the 8 GB RAM, 2 CPU General Purpose Droplet would beg-2vcpu-8gb
In order to get a full list of all the available Droplet sizes and their corresponding size slugs, you can:
/v2/sizes
API endpoint if you need to access them programmaticallydoctl compute sizes list
Hello, @yuwono
I will recommend you to check our tutorial for using the API:
https://www.digitalocean.com/docs/api/example-usage/
You can also check these two links:
https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet https://developers.digitalocean.com/documentation/v2/#delete-a-droplet
Hope this helps!