Reputation: 1228
I have a NodeJS WebApp which will soon run on an EC2 instance. This WebApp will have to store numerous files (less than 10 MB a file) into a MongoDB database.
My question is the following : Would it be wiser to host the database on S3 or EC2 ? And what would be the difference if I hosted it either on S3 or EC2 ?
EDIT : Ok, I'll add more specifications to help you understand better the situation.
My company needs a tool to retrieve and upload files, which I did via a WebApp created by myself (with NodeJS + React + Express).
These files are raw-data files, and I also need to link files between each other (for example, a raw-data file will be associated with its specs file in order to know how to decode it). Also, and that's why I chose a NOSQL database, some vars in these raw-data files will have to be stored with these files in order to get useful variables faster.
My enterprise has an enterprise account for AWS and in the EC2 instances dashboard, only the t2.micro is free to use. I will also specify that I'm doing an internship, so I'm not in position to negociate a budget ...
Upvotes: 0
Views: 1355
Reputation: 53813
tldr: You cannot host MongoDB database on S3.
S3 is an object store, it is not a FileSystem.
If you want to run a mongoDB instance, you will need to spin an ec2 instance and install it on an attached EBS volume. If you plan to have a lot of IOPS you should probably run an I3 instance and have either GP2 or IO1 EBS volume. If you dont plan a high usage to the DB, you can target M4 or C4 with GP2 (maybe start with that and go with other instance type if necessary)
If you ned to store files within your DB, host them directly in your mongoDB instance, access will be much faster, it is reasonably cheap and you can benefit from mongodb feature on BSon (index, search etc)
Upvotes: 6