Should I use AWS Lambda for my entire backend instead of Elastic Beanstalk?

I’m pretty new to backend development and trying to figure out the best approach for my mobile app. I’ve been looking at AWS services and noticed that Mobile Hub pushes you toward Lambda functions for serverless logic.

My main question is: Can I build a complete backend using just Lambda functions and API Gateway instead of running a traditional server with Elastic Beanstalk?

From what I understand, I have two main options:

  1. Use Elastic Beanstalk with servers running all the time and multiple API endpoints
  2. Use API Gateway to route different URLs to separate Lambda functions

The Lambda approach seems way cheaper since I only pay when functions actually run, but I’m worried about some potential problems:

  • I’d need separate Lambda functions for each API endpoint, which means duplicating shared code
  • Managing lots of individual functions seems harder than one codebase
  • Database connections would need to be established fresh for each function call

One idea I had was creating a single Lambda function that acts like a router and handles all requests internally based on parameters.

What are the main trade-offs I should consider when choosing between Lambda and Elastic Beanstalk for a mobile backend? Are there important factors I’m missing in this comparison?

what kind of mobile app are u building? traffic patterns make a huge difference here. if ur expecting steady usage, Beanstalk might actually cost less than Lambda. but if it’s sporadic, Lambda wins hands down. have u considered file uploads or websockets? those can get tricky with Lambda.

lambda’s perfect for beginners - zero server headaches. your router approach is solid, lots of devs do this to avoid duplicating code. just heads up on cold starts if you need lightning-fast responses. for db connections, rds proxy handles pooling really well.

I switched from Beanstalk to Lambda on my last project. The choice really depends on how complex your app is. A single router Lambda works great at first, but you’ll hit that 15-minute limit way sooner than you think with heavy operations. Database connection pooling is huge—I got burned when concurrent requests started timing out. Use connection pooling libraries or RDS Proxy from the start. Lambda’s biggest win isn’t the cost savings; it’s how it forces you to write modular code that’s easier to maintain. However, debugging distributed Lambda functions is a nightmare compared to regular server debugging.