In this guide, I will be walking through the process of setting up a droplet from your own windows computer, using Digitalocean’s API tool Doctl. This is something that can help you automate certain processes, such as setting up testing environments or servers on demand. Perhaps you and your buddies would like to quickly setup and tear down temporary game servers, without spending all that extra time configuring it? (Might cover this in the future) Whatever may be your reasons, I aim to provide the necessary information to help you get started setting up your own droplet from your own Windows machine.

Download doctl – digitalocean’s API tool

Go to the official github page for doctl.

From here, select the releases tab.

From this page, we will have to choose the windows version according to your own CPU.
If you are running on a computer with an AMD CPU (64bit), select doct-1.8.3-windows-4.0-amd64.zip. If you are running on an intel computer (32 or 64bit), select doctl-1.8.3-windows-4.0-386.zip.

(Optional) Find out which CPU your computer use

If you do not know whether you are running on an AMD or Intel CPU, open up the start menu and type in dxdiag.

The first time you run it, it is going to ask if you would like to check if your drivers are digitally signed. Select yes.

Here you should be able to see whether or not it says AMD or Intel(R) next to Processor. In my own case, I use Intel CPU.

Install and setup doctl

After you have downloaded the appropriate .zip file, extract the contents. I would recommend you rename it and put it under C:/doctl/ for ease of access. Whichever path you choose, make sure you keep using your own path throughout these examples.

 

Next we want to make sure we can access the doctl.exe file from any location via the command line/powershell, by adding it as a system path environment variable. With that done, you are able to run it from any location via the command line, powershell, or cmder.

Getting your API Token from Digitalocean.com

In order to make sure that only you can create droplets from your own account, we use API tokens. An API token is a randomly generated value, generated by digitalocean, that will act as your secure password and ID for interacting with the digitalocean API via doctl.

Start by logging in to your digitalocean account, and go to your API page.

Make sure you are in the Tokens/Keys tab and select the huge Generate New Token button in the middle.

A popup will show up, and ask you for a Token name, as well as whether or not to give it Write access. Leave it as is, and give it a recognizable and nice token name. Select Generate Token.

A new entry should have been added, and below the nice token name, you should see a long string.

Copy the string, either by doing it manually or pressing the invisible Copy button to the right of it. Make sure you store it somewhere secure. 

Now we have our token to use with doctl.

Authenticate yourself in Doctl

Opening up your favorite command prompt, type in (note that adding .exe is optional):

doctl auth init

It will then ask you for your digitalocean access token. Copy and paste it in. Make sure you do not have any trailing white spaces before pressing enter.
Assuming you entered the correct token, it should tell you that validation succeeded.

We are now ready to enter the appropriate commands to create our own droplets from the command line!

Creating a Droplet

Before we can create a droplet, we need to figure out where we want to host it, what type of image (OS) we want to run, and the size of the droplet.

The format we are going to run is:

doctl compute droplet create <name> --region <region-slug> --image <image-slug> --size <size-slug>

Picking a region

Let us begin by figuring out which region we want to host the droplet in. We can get a list of available regions by typing in the following:

doctl compute region list

Here you can choose the slug for the region you wish to use. For this example, I will use London 1, which has the slug name of lon1.

Picking an distribution or application image

We can choose whether or not we want use a clean distribution image, or a ready application image such as docker, GitLab, LEMP, and so on.
You can list the available distribution images by entering:

doctl compute image list-distribution

Here you can choose the slug for the image you wish to use. In the same manner, you can list available application images by running:

doctl compute image list-application

For this example, I will use the CentOS distribution image, which has the slug name centos-7-x64.

Choosing a droplet size

In order to list available sizes, we can run:

doctl compute size list

For this example, I will choose the cheapest one with a slug name s-1vcpu-1gb.

Create droplet

Now that we have our slug for region, image, and size, we can create our image from the command line.

Choose a name for the droplet, and fill the chosen slugs:

doctl compute droplet create <name> --region <region-slug> --image <image-slug> --size <size-slug>

Since I choose a server in London lon1, and a CentOS 7 image centos-7-x64, with a size of s-1vcpu-1gb, the full command would look like this, using the name my-droplet:

doctl compute droplet create my-droplet --region lon1 --image centos-7-x64 --size s-1vcpu-1gb

Done! 

You should now have your own running server. You should be receiving a password in your email associated with your digitalocean account in order to login.
If you go back to your digitalocean dashboard, you should see the new droplet under your resources.

 

Feel free to drop any C&Cs or questions in the comment below.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.