Cloud made easy: Get started with Digital Ocean

Build a web presence in minutes with DigitalOcean’s dead-simple cloud service

Cloud made easy: Get started with Digital Ocean
Claudia Regina (CC BY-SA 2.0)

When the boss wants a prototype as soon as possible or a client needs something tomorrow, the cloud is the best place to turn. You can have a fully configured machine serving data in minutes.

One of the most developer-friendly options is DigitalOcean, a cloud that offers fast machines at reasonable prices, delivering them in seconds. It doesn’t offer the fancier features that the major cloud providers do—at this writing—but it does package raw machines in a way that’s a breeze to deploy. If you’re a developer with an idea that needs a home, DigitalOcean’s machines are blank slates ready to go.

What’s on offer

Once paid for, DigitalOcean instances, called droplets, generally start in less than a minute. When combined with their reasonable pricing, this speed makes DigitialOcean droplets ideal for the buildup and tear-down common when testing and debugging new sites. With droplets, experimentation is easy.

There are several methods to begin with droplets, depending on your needs. Some developers will want a raw machine with a standard version of the operating system. That can be accomplished in a few steps. The rest of the build-out is up to you.

But if you need a common configuration, DigitalOcean offers a number of standard images that are ready to run. They can be deployed in about as many steps as the regular machines.

First, let’s build a basic machine, then we’ll turn our attention to what it takes to deploy a preconfigured image on DigitalOcean.

Build a basic machine on a DigitalOcean droplet

DigitalOcean’s droplets are akin to what other companies call “instances” or “virtual servers.” A droplet feels like a standalone box on your desk because you get the root password and access to all the file system, enabling you to configure it anyway you like. This is a bit of a facade because droplets are really virtual machines, each a share of a much larger machine that appears to be an independent server under your control. With this setup, it's relatively easy to resize your droplet to add more memory or disk space if your application demands it.

When you launch a droplet, you must make four major decisions and a few minor ones. Each takes only a few clicks on the web interface. (DigitalOcean also offers an API for automation.) They are:

  1. Operating system: DigitalOcean offers six of the major open source Unix operating systems. Most are built on Linux, but there’s also FreeBSD. All the recent major versions are also available. Windows, MacOS, or Solaris are not currently available. Many people use Ubuntu, the default choice.
  2. Size: Droplets come in 14 sizes priced for the most part by RAM. A standard machine comes with 2GB of RAM and costs 3 cents per hour or $20 per month. If you want twice as much RAM, you’ll pay twice as much. The size also determines the number of virtual CPUs, the amount of local disk space, and the amount of data you can transfer over the network, but these only roughly scale with price. When you switch from a droplet that costs 3 cents per hour to 6 cents per hour, you go from only 40GB of disk space to 60GB. You get more as you pay more, but what you get is not always proportional to the price. DigitalOcean also offers a very small machine with only 512MB of RAM. This is often sufficient for small jobs and is an ideal size for quick experiments. At the current price, $5 per month, it’s extremely attractive for trying out new ideas. It’s easy to set up and destroy a number of these machines without breaking your budget. You don’t have to agonize too much over your capacity decision because droplets can be resized later if you need more. (The other parameters listed here, like OS or location, can’t be easily changed.)
  3. Location: DigitalOcean maintains 12 datacenters around the world, and you should probably choose the one closest to your initial user base. You can always set up a worldwide network when demand grows. Worth noting is that only three of DigitalOcean’s datacenters currently support adding disk storage as a separate block: New York (NYC1), Frankfort (FRA1), and San Francisco (SFO2). These three alone offer the option to create a separate block of disk storage and mount it with your droplets. If you expect to make use of this, you must choose one of these three datacenters.
  4. Block storage: DigitalOcean recently started offering the option to create a separate block of disk storage that lives independently from your droplets. This is useful if you’re going to create persistent files or databases that will live on when the droplets are turned off. If you’re scaling up and down frequently by turning droplets on and off, it makes sense to store the persistent data in one of these blocks. They’re currently available only in three datacenters (NYC1, FRA1, and SFO2).

Beyond these choices, there are a few options worth noting. If you need to back up your machine, the simplest solution is to check the “backup” option, and DigitalOcean will create and retain four weekly backups of your machine for an extra charge of 20 percent. If you need more frequent backups, you’ll need to add this feature yourself.

If you are going to run several machines in the same datacenter and want to set up a private link between them, you can add a private network. If you need more protection between datacenters, you’ll need to add a layer of encryption to your stack instead. Indeed, you may want to make sure your communication between machines is encrypted even within the same datacenter. DigitalOcean is starting to roll out bare-bones telemetry that tracks basic statistics about your machine, like load and RAM consumption. This works only with a few of the major OSes like Ubuntu, and it can be enabled with a click.

There are also options for preloading data alongside the standard version of the OS. The most important is the SSH key that authenticates you when you log in. If you need more general data uploaded, DigitalOcean offers to upload a block of text that can contain arbitrary information.

After you’ve made these decisions, you can repeat the process by adding other droplets with the same configuration.

The last step is giving your droplet a name, so you can remember why you created it and what it is supposed to do.

After you push the button to deploy, you’ll get an email with all the particulars a minute or so later. Here’s what it will look like:

Droplet Name: frog

IP Address: 162.243.166.42

Username: root

Password: df166444718c2d80

 Once you receive it, log in and treat it like a new machine you’ve installed anywhere. That means changing your password and setting up work accounts so that you don’t need to log in as root. You’ll also want to run the following:

sudo apt-get update (to update the local package listings)
sudo apt-get upgrade
sudo apt-get dist-upgrade

Deploy a standard package from DigitalOcean

DigitalOcean offers a number of standard packages with popular open source software preconfigured, so it’s a snap to get up and running quickly. Many of the most common uses for servers come as prebuilt images, including options such as Drupal, WordPress, MongoDB, or Git.

Prebuilt images are a mixed blessing because not all of the software is as up-to-date as possible. It can be a challenge to keep up with the quick revision cycles of many open source projects, and DigitalOcean does not always update them immediately. For instance, when writing this piece, I built a droplet with an image consisting of Ubuntu 14.04 and Drupal 8.1.3, though Ubuntu 16.04 and Drupal 8.2.5 were freely available. This means you’ll have to do a bit more work once the droplet is built to update your OS and software to the latest versions.

The good news is that many of DigitalOcean’s scripts are comprehensive. They often complete many of the little details for creating accounts and building connections with the database. In the case of Drupal, the script builds an admin account, assigns a random password, and stores this password in the message of the day that you’ll see when logging into the droplet via SSH.

It looks like this:

——————————————————————————————————-

Thank you for using DigitalOcean’s Drupal application. We have created a base install that can be seen at http://159.203.122.32/, you should go there now and finish the installation process via the credentials below.

User: admin
Pass: kkRgaXUJrL

Nginx listens on public IP (159.203.122.32) port 80 and forwards requests to php-fpm listening on a socket. Nginx access log is in /var/log/nginx/access.log and error log is in /var/log/nginx/error.log To restart Drupal, run : sudo restart php5-fpm

DigitalOcean also provides useful information in a tutorial page for each option.

This can be enough information to hang yourself, however. When I built out Drupal 8.1.3, I quickly discovered there was a security problem with the build and it was important to upgrade to 8.2.5 as soon as possible. You should recognize that the scripts may save you plenty of time and effort, but they won’t remove the need to learn more about the underlying software. You’ll need to learn how to maintain it and watch for potential problems.

Building a complete “one-click app” with prebuilt DigitalOcean images is very similar to building a basic version of the operating system. You make the same decisions about size, location, and other details. DigitalOcean simply loads a slightly different image with the software running.

1 2 Page 1
Page 1 of 2
The 10 most powerful companies in enterprise networking 2022