Holy Crap, Systems Are Complicated

Holy Crap, Systems Are Complicated

In other news, water is wet

ยท

4 min read

The problem

I've stumbled upon what I think could be a fun small business to run; essentially its taking care of reminding people to send documents. I like the idea because its something that I can very likely have ready to test with customers within probably 1-2 weeks. With such a quick time to MVP I can test it without being too attached to the outcome. The only problem is, I don't have much experience building a full system like this, its been mostly CRUD web apps and backend services that don't need to deal with pesky user authentication thus far. My engineering degree is finally coming in use because I need to know about security methodologies (RBAC, UBAC, etc) and the very basics of systems design.

The very basics of what I'll need to get an MVP going are:

  • Front End (ofc, this will take the most dev time from me)
  • User management
  • Authentication
  • Object / Blob Storage
  • A database for User <=> Object mapping

I drew up a little diagram for how I imagine the whole backend will work: Untitled.png

This all needs to be hosted in Canada, because the target market is privacy regulation concious.

Now there is a decision to be made though -- do I go with a cloud provider for everything, or do I manage everything myself? We're going to assume 100 users for the first year, each user with an average of 5GB (some will have 10GB+, some will have <1GB. Its text documents so you'd have to be massive to hit 10GB). So a total of 500GB in storage. Additionally, let's assume an average of 100GB/month of traffic.

Cloud

Everything here is going to be priced as if I was buying it from AWS because that is likely where I would be buying from if I did end up actually using a cloud provider. Front end could be hosted on a nano instance, or just on Vercel for free. It cant be statically hosted because its a web app and will be fetching things from the BE and populating pages, and will need some API routes of its own to avoid CORS, etc. I'll price in about 3$ for that. User management and authentication would be done with AWS Cognito, and with <50k users its free (though 5 cents per user above that, so it could end up at 5$ ๐Ÿ˜ฑ). We'd need a database as well, and just looking at the pricing for any service with RDS in its name makes me sick (the lowest MySQL instance is 300$/month) so we're going to integrate the database with the backend server. Because the back end will be performing its normal functions, plus the database I went with 2vCPUs and 8GiB of ram. Without a reservation (I don't want to reserve without knowing that I'll continue the project) it comes to 57$ per month. Lastly, if we do some very approximate averaging to the amount of data stored and transferred with S3 we get around 13$/month. So the total charges for AWS end up at ๐Ÿฅ๐Ÿฅ๐Ÿฅ๐Ÿฅ๐Ÿฅ :

image.png calculator The largest part of this is EC2 at 57$/month.

Dedicated / Virtual Server / Self-Managed

I'd end up running K3S or something and hosting the services all on one machine. So I'll upgrade it to a 4vCPU machine, which ends up at 30$ CAD per month. For block storage, assuming 300GiB of in/out/storage per month (which is just about the busiest month I can imagine this product having) it'll be 8$ CAD. So in total everything would be about half of the AWS bill at 38$/month, but I have to manage it myself.

Third Hidden Option -- Self-host

I have a 16 thread, 24GiB Ram machine collecting dust at home. I used to be an avid gamer but sold my GPU in the hot market we have now because it was worth 200$ more than I paid for it 2 years ago. Theres also approximately 20TiB worth of HDD sitting around in it as well, because I also have a lot of.... Linux ISO's. So if I use that (which would probably run me in the neighbourhood of 300$/month if I rented it from someone else in Canada) I can host all of this for ~ FREEEEEEEE ~. There is of course the possibility of my power going out, but I live close enough to the city core that I could probably offer a 99.9% SLA and not worry about it.

Conclusion

I'll likely host everything for free on my own hardware until the idea is validated. If I can get 1-2 paying customers before the end of February, I'll upgrade to a virtual server from OVH. By then I'll know the real processing power requirements as well! Finally, if I can get a decent customer base, I'll switch to AWS so that I can do multi-region more easily.

Thanks for reading

ย