I'm trying to figure out the costs for hosting and running three applications/services on either EC2 or ECS. My project requires two backends (Node and Python) and a Next.js front end. My workplace is aiming for a minimal yet efficient setup. I have hands-on experience with EC2 for low to medium-tier projects, but these were mostly personal projects. The challenge is that the documentation mentions billing is done per hour. I'm interested to know if there's a cap on API calls or compute hour usage for EC2 instances, particularly with the basic t2.nano configuration with 8 GB of RAM.
The main mobile app is expected to support about 150 users for 12 hours daily, leading to approximately 6000 API calls each day (this is a safe upper limit). Meanwhile, the Next.js dashboard would serve around 50 users also for 12 hours, and we estimate roughly 12,500 API calls daily. I'm curious if this load would overwhelm the EC2's resources. If it doesn't, how much might the costs increase? Also, if I go the EC2 route, I would be hosting all three services on separate instances with the same basic configurations. Additionally, how does ECS Fargate stack up against this setup? I know it tends to be pricier than EC2.
6 Answers
If you're using Linux, consider switching to t4g instances (ARM64 Graviton), as they could save you even more money whether you opt for EC2 or ECS. Personally, I lean towards ECS because deploying containers is way easier than updating EC2 instances.
EC2 is simply a virtual machine—traffic, API calls, everything flows through it with whatever OS you’re running. ECS is like the container-based version. For your traffic, unless it's a very resource-intensive application or all users hit it simultaneously, you could likely run everything on minimal resources. My low-end Raspberry Pi could handle your described load easily.
ECS is not a compute service on its own; it's a container orchestration tool. For running your workloads, you'll either be managing EC2 instances or going for Fargate. With Fargate, you're charged based on your usage, which might ultimately save you money compared to managing multiple EC2 instances.
Whether you choose EC2 or ECS, the pricing remains identical as long as the instance count is the same. Just keep in mind that you'll incur additional costs if you decide to include a load balancer for ECS. Fargate tends to be about double the price, so consider that if you want to keep costs low. EC2 has the flexibility to support significantly larger projects too, if needed.
You've got three solid options for a small setup: 1. Set up an Auto Scaling Group for seamless app deployment. 2. Use ECS on EC2, which could be your most budget-friendly choice in the long run, although it requires some manual scaling maintenance. 3. Try ECS on Fargate; this is a bit pricier but really simplifies managing your infrastructure.
Since your setup seems relatively small at the start, I'd recommend going with Fargate. Though it might cost $50 more per month, it saves you precious time setting everything up correctly, especially if you're not well-versed in DevOps. As you grow, switching from Fargate to ECS-EC2 shouldn't be too difficult.
Silly question, but have you tried building mock databases for both options and running load tests? Checking out cost implications through actual testing can provide really useful insights.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads