Want to create a DigitalOcean Droplet with SSH key?

We can add the key of our local machine when creating a droplet.

At Bobcares, we often receive requests to create a droplet with SSH key as a part of our DigitalOcean Managed Services.

Today, let’s discuss how our Support Engineers create a DigitalOcean droplet with an SSH key.


SSH key authentication

The SSH key is similar to a username and password.

We can add a key to DigitalOcean Droplet when creating it or after creating a droplet.

Once we add the SSH key to the Droplet we can log in to the server from that machine without password.

Let us discuss how our Support Engineers create a Droplet with SSH key


How we create a droplet with SSH key?

First, we log in to the DigitalOcean control panel.

Then we click on Create in the top right corner and from the drop-down we select Droplets.

Now we need to Choose an image, thus we select the OS and the version.

Then in Choose a plan, we select the plan based on the requirements.

In Choose a datacenter region we select the region for the Droplet.

Then in Authentication, we select SSH keys and click on New key. Now a Window appears where we add public SSH key.

Thus, we use OpenSSL to generate a key for Linux and macOS. We use PuTTYgen to generate a key in the Windows machine.

Let us discuss both the methods used to generate a key in the customers local machine.


1) Generate SSH key with OpenSSL for Droplet

First, we open the terminal and run the following command


Now a prompt appears to enter the file name to save the key. We just press enter. Thus, it takes the default location.

Then a prompt appears to create and confirm a passphrase for the key. If we add a passphrase, we need to enter every time the key is used.

Thus, we Press Enter to bypass the prompt. Thus, two files are generated by default id_rsa and id_rsa.pub.

Now we copy and paste the content of the id_rsa.pub. We use the command the view the file.

cat ~/.ssh/id_rsa.pub

Thus, we copy the key and paste it in the DigitalOcean panel.


2) Generate an SSH key with PuTTY for Droplet

If we need to connect to a Linux machine from Windows we need an application PuTTY.

Thus, we install PuTTY. Also, we install PuTTYgen to generate the key.

Once we install it we open PuTTYgen. In the parameter section, we select the type of key to generate.

We click on Generate. Then we move the mouse over the application to generate a key.

Thus, we get the public key and the private key. We save the private key.

We paste the content of the public key in the DigitalOcean panel.

DigitalOcean create droplet with ssh key

Once our customer provided us the key. We proceed with the further steps.

Next, we enter a Name for the key.

Finally, we click on Add SSH key.

Once we add the SSH key we proceed creating the droplet.

Then in Finalize and create, we select the number of Droplets to create, and we enter a hostname for the Droplet.

In the Add backups section, we check Enable Backup. Enabling it will automatically take backup weekly of the droplet.

Finally, we click on Create Droplet.


[Need assistance to manage droplets – We can help you]



In short, we have discussed the key-based authentication. Also, we saw how our Support Engineers create a DigitalOcean droplet with SSH key for our customers.


Source link


Write A Comment