Example, I'm developing a simple Python project that uses database. Need db service that I don't want to manage. Also, want to auto scale
I currently have ~30 containers running on a Hetzner server w/ 64GB of RAM and 16 dedicated cores for ~$25/mo. I even get direct access to the Intel iGPU for graphics acceleration at no additional cost.
Cloud providers like AWS give you a couple orders of magnitude less resources for the same dollars. Too many engineers are getting fleeced into using crappy solutions (VPS's, almost anything by AWS/Azure/GCloud/Digital Ocean) because they're all they've ever known.
1) CloudRun ( run a Docker container exposing a port to the web )
It can autoscale.
2) CloudSQL ( managed Postgres and some other SQL choices )
We faced some friction getting the two connected. CloudSQL is available on an IP address, then in our code we have PSQL library which we specify the IP address to. The complication was that CloudRun instances can't actually "see" the CloudSQL. After navigating the GCP documentation, website, and some trial and error, it magically worked.
It was painful to get setup but it's running smooth now.
For recent projects where auto scale is not needed I‘m happily using FlightPHP as a REST framework and use SQLite as my db service. Frontend UI is provided by just including Bootstrap.
This setup feels great, because it takes me back to my origins of web development: simple tools that work and get stuff of my plate.
Before installing 250 MB of NPM dependencies, pre-processors etc.
I got myself a dedicated box from OVH, located in Canada. 32 threads, 64 GB EEC, NVMe disks and unmetered 1Gbps outgoing link. That cost me ~$100.
In it I had my application server and database, as well as disk caching layer in front of S3.
No need to worry about auto-scaling, as that beefy server could take care of 10-100x more users than I currently handled.
No need to worry about bandwidth costs or getting DDoSed. The gigabit link was more than sufficient (I think I used 5% of it), and OVH provides an anti-ddos service included in the price.
I had a cheaper ($10) dedicated box from Kimsufi which I used to host CI, Phabricator and other non-critical stuff.
I'd deploy with a simple ansible script which would launch a new docker container that HAProxy would then point to (similar to a green-blue deployment). This allowed me to deploy small changes[0] silently and I could test them before the actual release.
My side project was not critical enough, so if for any reason my host was unreachable I could perform a disaster recovery anywhere else by restoring from my backups. In ~4 years, I never had to do that.
If I were to start a side / weekend project today, I would probably follow a similar route. Running cloud compute instances with unpredictable bandwidth billing gives me anxiety.
[0] - As long as they did not have database migrations in them.
Digital ocean droplet for hosting my typescript node backend (api) server. Sqlite for storage ($5/mo). Right now I'll typically just git pull when I want to redeploy, however depending on the project I may setup a docker compose script to spin up containers, that gets automatically run on commit to main.
I let cloudflare handle DNS for free also, and have it proxy to sideproject.com / api.sideproject.com for ddos mitigation.
Auth0 free tier for handling auth between.
I haven't had a problem scaling because its all lambda so it scales nicely and is all self contained for functions.
I've used DynamoDB with is even simpler but if you think you'd ever want something relational or more familiar I would definitely go with Postgres RDS
You can deploy containers, lambda functions, SQL databases, Redis, MongoDb and many more infrastructure components with just a few lines of config.
(I work at Stacktape)
You can see that code here if you're curious: https://github.com/lunasec-io/lunasec/blob/master/lunatrace/...
It's more complicated now but if you look at the history of that "backend-cdk" folder then it's simpler a few months ago.
The important bit is the "ecs-patterns" library. That's the one that is magical and deals with setting up the load balancer, cluster, etc for you. And the way we shove the Docker images in I found to be quite straightforward. (And deploys are one line)
when egress bandwidth is needed i use cloudflare workers + r2 just like i would use s3 presigned urls.
services with no usage should have no cost. services with usage should bill based on usage.
typically i start from a full project template[1][2]. sometimes i start from scratch[3].
1. https://github.com/nathants/aws-gocljs
Managed DB: Railway, Render, Planetscale, Supabase
It's straight forward to deploy, has a generous free tier and scales really well. If I need an sql database, I'll spin one up on aws, but hopefully I'll switch to neondb soon.
If it's a daemon, I write a systemd service file.
I also have 2 dedicated one from a small reseller, one from Kimsufi. They run heavy services like monitoring and additional backups essentially everything where I don't care about 100% uptime.
All public downtimes I've had in the last 4 years or so we're 100% my fault.
Edit:// Its less than $100 for several million page views and some heavy monitoring.
Frontend is that handcrafted artisanal static HTML hosted on CloudFlare Pages, and simple button for checkout to Shopify/Stripe/whatever.
The damn licensing for publishing my iOS app costs more than my entire infrastructure. Stay lean!
Honestly, I should simply move to "serverless" ala AWS Lambda, but probably won't until (if) things go gangbusters.
At this point I just have a template to do it and reuse it in my various projects.
If I don't need a server, I usually just use the Serverless framework.
Buy a $1/mo cpanel-based hosting (php+mysql+nodejs+python included), scale as needed, depending how much the traffic it gets (well, most of the time my weekend project is not accepted by the market.. haha)
I don't need a DB I don't manage (I can handle mysql).
I don't need auto-scaling (and I'll go out on a limb and say that you don't either).
Digital Ocean Web Service $5.00
Digital Ocean Worker $5.00
---------------------------------
$10.00 per month
1. If DB is needed - Google App Engine with Datastore (default) or Firestore
2. If no DB - Google App Engine (default) or Cloud Run
Always amazes me when people try to design Google-scale solutions to 0.3 QPS problems.
I’m usually utilizing a static site generator for main site; usually S3 behind a CDN.
Then I’ll typically have my services written in go running serverless behind apigateway. Then locally I just have my services running on a generic http framework.
Now I'm adding Cloudflare in front of it.