Prerequisites
- A Clouddley account
- An AWS account
- AWS CLI installed and configured on your local machine
- AWS Access Keys with permissions to create and manage EC2 instances
- Git installed locally
- Basic familiarity with the Linux command line
Create an AWS EC2 Instance
Create an EC2 instance to host your app. With AWS CLI, you can quickly create one. First, create a VPC and security group if you don’t want to use the default ones.- Create a VPC by running the command::

Create a VPC on AWS
- Create a security group by running the command::
Replace the
vpc_id with the one created in the previous step. 
Create a Security group on AWS
- Allow inbound traffic on port 22 (SSH) by running the command:
Replace the
sg_id with the one created in the previous step. - To create an EC2 instance, you need to have an SSH key pair. If you don’t have one, you can generate and import one below.
How to Generate and Import SSH Keys to AWS
How to Generate and Import SSH Keys to AWS
If you don’t have an SSH key pair on your local machine, follow the steps below.Press Enter to accept the default file location and choose a passphrase if you want one.
- Step 1: To generate an SSH key, run the command:
- Step 2: To add your SSH key to AWS, run:
Replace the path to your public key if it’s different.
- Finally, create the EC2 instance:
- Replace ami-xxxxxxxx with regions’s compatible AMI
- Replace my-key with your key pair name
- Replace sg_id with your security group id

Create a EC2 instance on AWS
Once the instance is running, note the Public IP address of the instance. You’ll need it later.
Deploy
Now you have your AWS EC2 instance set up, it’s time to deploy a MongoDB database using Clouddley. Step 1: Access Databases- Log in to your Clouddley account.
- Navigate to the Databases on the left sidebar.
- Click on Deploy Database

Accessing Databases
Step 2: Configure your virtual machine(VM)
- In the choose or add server dropdown, select your VM if it’s listed. If not, select + Add Virtual Machine and enter your EC2 instance 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.
How to Install Clouddley CLI to Verify your AWS EC2 Instance
How to Install Clouddley CLI to Verify your AWS EC2 Instance
- 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 EC2 instance:
- Install Clouddley CLI by running the command:
- To add the SSH public key, run the command:
- Click Verify to check the connection.
- Once verified, click on Next.

Configure virtual machine on Clouddley
Step 3: Configure your database name
- Enter a name for your MongoDB database.
- Click on Next to proceed.

Defining a unique name for the MongoDB database
Step 4: Select your database type and version
- Choose MongoDB as your database type.
- Select the version of MongoDB you want to deploy.
- Enable delete protection to prevent accidental deletions.
- Click on Deploy DB

Selecting the MongoDB database type and specifying the version
Step 5: Confirm deployment
- Once your deployment is complete, you will see a confirmation message
Deployed successfully!

MongoDB database successfully deployed
Step 6: Open database port on AWS EC2 instance
- Check the port Clouddley has configured for your PostgreSQL database. Then, add a new rule to your AWS security group to allow traffic for that port. For example, if Clouddley configured port
17315, run:
Replace the
sg_id with the one created earlier. Manage your database
The Database dashboard makes it easy to manage your MongoDB database on an AWS EC2 instance. 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.

Database dashboard
Conclusion
That’s all it takes, your MongoDB database is now deployed on AWS with the help of Clouddley, running smoothly on an EC2 instance. Instead of getting stuck in setup details, you now have a clean foundation to store and manage data. From here, you can connect your applications, scale as needed, and trust that your database is ready to support whatever you build next. Got feedback or ideas to improve the experience? We’d love to hear from you. We can’t wait to see what you deploy next!Getting started with Clouddley?
A backend infrastructure for your own compute. Run apps, databases, brokers, and AI workloads on your VMs, bare metal, or VPS.
