DigitalOcean droplets are Linux based VM’s that run on virtualized hardware. Droplet means a new server, we can create a new server by choosing standalone or larger plans.
We can create different types of droplets based on the plans provided in the DigitalOcean account. It provides different types of OS with different versions like CentOS, Ubuntu, Fedora, Debian.
To create a DigitalOcean Droplet with SSH Key Access, you can follow these steps.
- Login to the DigitalOcean account.
- Click the green colored create button on the right side of the page.
- From the create menu choose the droplets option and it will show the resources page.
- If you have any droplets already created it will show in this resource section or if you need to create a new droplet proceed with the “Get started with a droplet ” button.
- The next option will show the customizations. Select the choose an image option, in this, there are four options;
Distributions – Select the type of OS distribution like CentOS, Debian, Ubuntu, FreeBSD, Fedora.
Container distributions include Rancher OS.
Marketplace – It includes pre-configured application images like WordPress, LAMP, Docker, etc to make easy the work.
Custom images – It is a type of Unix like images that we can create and upload to our DigitalOcean account.
- The next step is to choose a plan, here we need to choose the amount of RAM, CPU cores, and storage space.
- If you need to enable weekly backup then check the enable backups option in the Add backup section.
- If you need additional volumes for the droplet then proceed with the Add volume option.
- Next, we need to select the region where we need to create the droplet. For this select from the Choose a datacenter region option.
- Select Additional options if you need to enable VPC network, IPV6, user data, and monitoring.
- The authentication section helps to login to the droplet using either the SSH key or the password that we added.
To add SSH Key to a Droplet
For Linux type systems we can use openssh tool which uses ssh-keygen utility to generate SSH key-pair.
Then this will generate private/ public key-pair and the default location for storing the keys will be ~/.ssh folder. The id_rsa indicates the private key and id_rsa.pub indicates the public key.
Generating public/private rsa key pair : Enter file in which to save the key (~/.ssh/id_rsa) :
The next option will ask you to enter the passphrase for generating the key. Passphrase helps to encrypt the key and if we enter any passphrase we need to provide it whenever we use the key. We can provide a passphrase or just ENTER it.
Created directory '~/.ssh/' Enter a passphrase or enter empty for no passphrase : Enter same passphrase : Your identification has been saved in ~/.ssh/id_rsa. Your public key has been saved in ~/.ssh/id_rsa.pub. The key fingerprint is : The key's random part image is ;
Then the SSH Key will be generated successfully.
In order to add the SSH key to the Droplet follow the below steps ;
- Click SSH key option from the Authentication section and proceed with the Add SSH key option, then paste the public key there and provide a name for the key.
- Then click the finalize and create a section and then proceeds with the Create droplet.
So from this, we have created a DigitalOcean droplet successfully and we can login the server using the IP address given from the resource’s droplet section and SSH Key.