I'm very new to Iot project and programming. I've got an ESP01 with a simple accelerometer and I'd like to send its data to a database. Now I already tested locally on my machine all of this and everything works fine.
This is what I'm using
Esp01 + accelerometer sending data to mqtt broker mosquitto running locally on my machine, a node-red app which send those data to Influxdb and then grafana to display those data.
Now I'd like to host everything on a cloud server AWS. I found out that I should create an AWS EC2 instance and install Node red and MQTT on an Ubuntu machine. The big question form me is
"Should I create one instance for Node red and one instance for MQTT broker or I can use just one instance and install both of them on it?"
Last but not least question should I do the same for influxdb?
It all depends on money. If you strictly followed the AWS guidelines they would tell you that you should have a load balancer and at least two m-type instances and each service probably should have its own pair of instances. That way - if one node fails, there will be no downtime. That setup can cost you maybe around $100/month.
But for this kind of project (just for yourself) I would go with just one small (the smallest possible) instance and I would put everything on it. It's good to know that in AWS any instance can fail in any time. It's rare, but when you have thousands of instances, it happens on regular bases. Therefore - the simplest solution is to create your setup with Cloudformation and have a regular backup. Possibly you can create an autoscaling group with just one instance. if it fails, it will get automatically replaced and you can (automatically or manually) recover the data from your backup. For example during the boot it can look for the last backup in s3 and install it (via the script in meta-data).
This is not perfect, but for sure it is acceptable for a hobby project. And it is cheap.