Getting up to speed with Mongo community for your development is super easy with Qumulus.
Create a new instance, select Ubuntu 24.04, Instance type as t1.small (or the size which suits you) and add script to the user data section, click launch!
Here is the 'user data' script you can use
#!/bin/bash
# This is a basic setup intended for development purposes.
# Update package list and install required packages.
apt update > /dev/null 2>&1
apt-get install -y gnupg curl ufw
# Setup MongoDB repository.
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu $(grep '^UBUNTU_CODENAME=' /etc/os-release | cut -d'=' -f2)/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list
apt update > /dev/null 2>&1
apt-get install -y mongodb-org
# Configure MongoDB to listen on all interfaces and enable authorization.
sed -i "s/bindIp: 127.0.0.1/bindIp: 0.0.0.0/g" /etc/mongod.conf
sed -i "s/#security:/security:\n authorization: enabled/g" /etc/mongod.conf
systemctl daemon-reload
systemctl start mongod
systemctl enable mongod
# Wait for MongoDB service to be ready (max 30 seconds).
for i in {1..30}; do
if mongosh --eval "db.adminCommand('ping')" >/dev/null 2>&1; then
echo "MongoDB is ready"
break
fi
sleep 1
done
# Create admin user.
# Replace 'PleaseChangeYourPassword' with your actual secure password once the installation is completed.
MONGODB_USERNAME="admin"
MONGODB_PASSWORD="PleaseChangeYourPassword"
mongosh --eval "db.getSiblingDB('admin').createUser({user: '$MONGODB_USERNAME', pwd: '$MONGODB_PASSWORD', roles: [ { role: 'userAdminAnyDatabase', db: 'admin' }, 'readWriteAnyDatabase' ]})"
# Enable UFW if it's inactive.
if ufw status | grep -iq "inactive"; then
echo "y" | ufw enable
fi
# Allow incoming TCP connections on MongoDB port (27017) and SSH (22).
ufw allow 27017/tcp
ufw allow 22/tcp
ufw reload
Once your instance is up and running, You can assign a public IP to it and SSH to it .Make sure you have inbound rules defined to allow SSH for the instance and open port for Mongo in the assigned to your VM.
First things first. Let's change the password for Mongo. and run following command with current password.