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:
- Use Elastic Beanstalk with servers running all the time and multiple API endpoints
- 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?