> ## Documentation Index
> Fetch the complete documentation index at: https://blog.clouddley.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Deploy a MongoDB Database on a DigitalOcean Droplet using Clouddley

> Learn how to deploy a MongoDB database on a DigitalOcean Droplet using Clouddley.

export const date_0 = "Updated on July 08, 2025"

[MongoDB's](https://www.mongodb.com/) document-based architecture makes it perfect for applications that handle unstructured data, from content management systems to IoT platforms. When you need to deploy a MongoDB database with zero downtime and minimal setup, [Clouddley](https://clouddley.com) takes care of the heavy lifting for you on DigitalOcean Droplets.

This tutorial walks you through deploying a MongoDB database using Clouddley. You'll have a production-ready MongoDB database running in minutes.

## Prerequisites

To follow this tutorial, you will need:

* A [Clouddley account](https://clouddley.com)
* A [DigitalOcean account](https://www.digitalocean.com)
* [`doctl` (DigitalOcean CLI)](https://docs.digitalocean.com/reference/doctl/how-to/install/) installed and configured
* [DigitalOcean API](https://cloud.digitalocean.com/account/api/tokens) token generated
* Basic knowledge of the command line.

## Create a DigitalOcean droplet

For this tutorial, we will use `doctl`, the official DigitalOcean CLI, to create a Droplet. Make sure you have the DigitalOcean CLI (doctl) installed.

Before you begin, ensure you have your DigitalOcean API token ready.

* Authenticate with your DigitalOcean account by running the following command in your terminal:

```bash theme={null}
doctl auth init
```

* Enter your <b>API token</b> when prompted. This will allow `doctl` to interact with your DigitalOcean account.

* Before creating your Droplet, make sure you have your `vpc_uuid` and `SSH key` added to your DigitalOcean account.

<Accordion title="How to find your VPC UUID">
  Open your terminal and run the command:

  ```bash theme={null}
  doctl compute vpc list
  ```

  This will display all your VPCs along with their UUIDs. Choose the one you want to use for your Droplet.
</Accordion>

<Accordion title="How to add your SSH Key to DigitalOcean">
  Open your terminal and run the command:

  ```bash theme={null}
  doctl compute ssh-key list
  ```

  If you do not have a previously created one, follow the steps below.

  <b>Step 1:</b> To generate an SSH key, run the command:

  ```
  ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  ```

  Press <b>Enter</b> to accept the default file location and choose a passphrase if you want one.

  <b>Step 2:</b> To add your SSH key to digitalocean, run:

  ```
  doctl compute ssh-key create "my-key-name" --public-key-file ~/.ssh/id_rsa.pub
  ```

  Replace `my-key-name` with a name you’ll recognize.
</Accordion>

* Now, create a new Droplet using the following command:

```bash theme={null}
doctl compute droplet create db-droplet \
  --image ubuntu-24-10-x64 \
  --size s-1vcpu-1gb \
  --ssh-keys your_ssh_key_id \
  --region nyc1 \
  --vpc-uuid your_vpc_uuid
```

<Note>Make sure you replace `your_vpc_uuid` and `your_ssh_key_id` with your actual values. The SSH key added here allows Clouddley to securely connect to your Droplet during deployments.</Note>

You will see the output below

<img src="https://mintcdn.com/clouddley/YkMcNqR8t_n43UbS/images/create-db-droplet.png?fit=max&auto=format&n=YkMcNqR8t_n43UbS&q=85&s=087a16cbe21cc6ea3587ffaf8cc8bbb5" alt="Creating a droplet in DigitalOcean" width="2670" height="175" data-path="images/create-db-droplet.png" />

You've created a droplet named `db-droplet` with `Ubuntu 24.10 x64` image in the `nyc1` region.

* To confirm your Droplet was created successfully, run the command:

```bash theme={null}
doctl compute droplet list
```

You should see your newly created Droplet in the list.

<img src="https://mintcdn.com/clouddley/YkMcNqR8t_n43UbS/images/list-db-droplet.png?fit=max&auto=format&n=YkMcNqR8t_n43UbS&q=85&s=793060371e559e9cc0238532cbdeb77c" alt="Listing all droplets in DigitalOcean" width="2702" height="180" data-path="images/list-db-droplet.png" />

Make sure to note the <b>IP address</b> of your Droplet, as you will need it later.

## Deploy

Now that you have your Droplet set up, it’s time to deploy a MongoDB database using Clouddley.

<b>Step 1: Access Databases</b>

* Log in to your [Clouddley account](https://app.clouddley.com/auth/signin).
* Navigate to the <b>Databases</b> on the left sidebar.
* Click on <b>Deploy Database</b>

<Frame caption="Accessing Databases">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-dashboard.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=98b7fbb13523d355fa5d87886511629f" width="3780" height="1705" data-path="images/Dbs-dashboard.png" />
</Frame>

<br />

<b>Step 2: Configure your virtual machine(VM)</b>

* In the **choose or add server** dropdown, select your VM if it's listed. If not, select **+ Add Virtual Machine** and enter your droplet's IP address as the **VM host**, along with the **VM User** and **SSH port**.
* After adding the details, verify the connection with the **Clouddley CLI (recommended)** or **SSH.**

<Accordion title="How to Install Clouddley CLI to Verify your DigitalOcean Droplet">
  - Open your local machine’s command line, then connect to the remote VM you want to configure with Clouddley. Use this command to SSH into your DigitalOcean Droplet:

  ```bash theme={null}
  ssh root@<your-instance-ip>
  ```

  * Install Clouddley CLI by running the command:

  ```bash theme={null}
  curl -L https://raw.githubusercontent.com/clouddley/cli/main/install.sh | sh
  ```

  * To add the SSH public key, run the command:

  ```bash theme={null}
  clouddley add key
  ```

  Using the CLI, you can deploy resources, manage configurations, and automate tasks efficiently.
</Accordion>

* Click <b>Verify</b> to check the connection.
* Once verified, click on <b>Next</b>.

<Frame caption="Configure virtual machine on Clouddley">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-configure-vm.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=d18addba7ce0b3a86338d06f5790100d" width="3820" height="1707" data-path="images/Dbs-configure-vm.png" />
</Frame>

<br />

<b>Step 3: Configure your database name</b>

* Enter a <b>name</b> for your MongoDB database.
* Click on <b>Next</b> to proceed.

<Frame caption="Defining a unique name for the MongoDB database">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-mongo-name.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=4980b188248843697349301e5d833718" width="3810" height="1715" data-path="images/Dbs-mongo-name.png" />
</Frame>

<br />

<b>Step 4: Select your database type and version</b>

* Choose <b>MongoDB</b> as your database type.
* Select the <b>version</b> of MongoDB you want to deploy.
  <Tip>Ensure you select a version that is compatible with your application requirements.</Tip>
* Enable delete protection to prevent accidental deletions.
* Click on <b>Deploy DB</b>

<Frame caption="Selecting the MongoDB database type and specifying the version">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-mongo.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=a72fda0fdc306b993c1322d0f9e4d449" width="3807" height="1720" data-path="images/Dbs-mongo.png" />
</Frame>

<br />

<b>Step 5: Confirm deployment</b>

* Once your deployment is complete, you will see a confirmation message `Deployed successfully!`

<Frame caption="MongoDB database successfully deployed">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-success.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=27451216c04bccb1a40f0d4d41acb4d0" width="3815" height="1712" data-path="images/Dbs-success.png" />
</Frame>

You can now connect your MongoDB database to your application.

## Manage your database

The Database dashboard makes it easy to manage your MongoDB database on DigitalOcean. You can deploy, monitor, and maintain your database.

Here’s what you can do:

* View real-time logs to check performance and troubleshoot fast.

* Reset passwords securely with built-in authentication and encryption.

* Prevent accidental deletions with built-in delete protection.

* Manage the database users and access control.

<Frame caption="Database dashboard">
  <img src="https://mintcdn.com/clouddley/p_iVNvg5jCvbMG-4/images/Dbs-mongodb-overview.png?fit=max&auto=format&n=p_iVNvg5jCvbMG-4&q=85&s=94fb96542ffa700cd8a2a2e2c255ee66" width="3787" height="1717" data-path="images/Dbs-mongodb-overview.png" />
</Frame>

Everything you need to manage your database is right where you need it.

## Conclusion

You’ve successfully deployed MongoDB on a DigitalOcean Droplet using Clouddley. With a few simple steps, you removed the complexity of manual setup and enabled faster, more reliable provisioning.

Got feedback or ideas to improve the experience? We’d love to [hear from you](https://clouddley.productlane.com/roadmap). We can’t wait to see what you deploy next!

<Card title="Getting started with Clouddley?" icon="user-plus" cta="Sign up today and enjoy a 30-day free trial — no credit card required" href="https://app.clouddley.com/auth/signup" horizontal>
  A backend infrastructure for your own compute. Run apps, databases, brokers, and AI workloads on your VMs, bare metal, or VPS.
</Card>

## Additional Resources

* [Clouddley Documentation](https://docs.clouddley.com/)
* [MongoDB Documentation](https://www.mongodb.com/docs/)
* [DigitalOcean Droplet guides](https://docs.digitalocean.com/products/droplets/)

<div className="flex items-center gap-2.5 mb-6 py-0 my-0">
  <img src="https://res.cloudinary.com/dkbbdg1ko/image/upload/faith-kovi-headshot_hbezxg" alt="Faith Kovi" className="w-12 h-12 rounded-full" />

  <div>
    <div className="flex items-center gap-3">
      <p className="text-sm text-gray-600 dark:text-gray-300 flex items-center gap-1 py-0 my-0">
        <span>By</span>

        <a href="https://x.com/Vera__Kaka" target="_blank" rel="noopener noreferrer" className="font-semibold">
          <span>Faith Kovi</span>
        </a>
      </p>

      <button
        onClick={async () => {
      if (navigator.share) {
        try {
          await navigator.share({
            title: document.title,
            text: "Check this out!",
            url: window.location.href,
          });
        } catch (error) {
          console.error("Error sharing:", error);
        }
      } else {
        alert("Sharing not supported on this device/browser.");
      }
    }}
        className="ml-1 hover:scale-110 transition-transform duration-200 ease-in-out"
      >
        <Icon icon="share-nodes" iconType="light" color="#D1D5DB" size="20" />
      </button>

      <button
        onClick={() => {
      navigator.clipboard.writeText(window.location.href);
      alert("Link copied!");
    }}
        className="ml-1 hover:scale-110 transition-transform duration-200 ease-in-out"
      >
        <Tooltip tip="Copied!">
          <Icon icon="clone" iconType="light" color="#D1D5DB" size="18" />
        </Tooltip>
      </button>
    </div>

    <p className="text-xs text-gray-500 py-1 my-0">
      {date_0}
    </p>
  </div>
</div>
