Clone the Terraform example repo and follow the explained steps to get it running.
Be sure to open all necessary ports in your security groups used by the instance to make it available to the public.
Follow the Tutorial to config serverless on your machine.
Follow this Tutorial to get the db on your instance runnning.
- Pay attention to the right
'
when copying the commands, otherwise you might get errors during your workthrough
Fix the permissions of the mongodb before starting it as a service with the following code:
# default path /data/db
cd /path/to/your/db
sudo chown -R mongodb:mongodb *
# or this
sudo chown -R $USER /data/db
Before starting the db as a service edit the mongo.conf
and update dbPath, and network interfaces
# mongod.conf
# Where and how to store data.
storage:
dbPath: /data/db
# network interfaces
net:
port: 27017
bindIpAll: true
security:
authorization: enabled
Now you should be able to login to your db and fill it with data.
Check out the following Tutorial and find out how to get serverless provinding an API for you database. Furthermore test your routes offline with serverless offline.
Some important code snippets of the tutorial are broken and you have to look here for the snippets: Tutorial.
With this information you should be able to make your database accessible via a restful API. Good luck..