AWS EC2 vs Lambda hosting

EC2 - CodeStar Lambda - CodeStar Lambda - Chalice Lambda - Serverless Lambda - Zappa
Uses EC2 instances Uses AWS Lambda and API Gateway Uses S3, AWS Lambda and API Gateway
Can run in local environment Cannot run in local environment Can run in local environment Cannot run in local environment Can run in local environment
Cheapest config: Free tier - t2.micro - 1 vCPU - 1 GB Memory - 8 GB EBS Cheapest config: 128 MB Memory
Based on Servers installed in EC2. For Eg: Python Flask or Node Serverless. Based on lambda functions and layers Serverless. Based on lambda functions and layers. Uses Chalice micro framework Serverless. Based on lambda functions and layers. Uses Serverless framework Serverless. Based on lambda functions and layers. Uses Zappa micro framework
Supports Python, Nodejs, etc Supports Python Supports Python, Nodejs, etc Supports Python
Supports Flask and Flask-Restful No support for Flask Flask like routing No support for Flask. Supports Flask. Seems not supporting Flask-Restful
Flask file structure No specific file structure Multi file structure using blueprints Single file structure
1 EC2 + 1 Code Pipeline 1 Lambda Function + 1 Code Pipeline 1 Lambda Function 1 Lambda Function for each route 1 Lambda Function
t2.micro: 1GB Default Memory: 128MB Default Memory: 128MB Default Memory: 1024MB Default Memory: 512MB
Dependency added using pip and build scripts Dependency added using pip and lambda layers Dependency added using requirements.txt and lambda layers Dependency added using yml Dependency added using virtual env
Available when EC2 is on 24x7
Dynamic IP or URL.
Static IP is billed.
No dynamic IP or URL.
Free Static URL.
750 EC2 hours/month free.
30 GB EBS free.
1 Million request/month free.
3.2 Million exec seconds/month free.
Free tier for 1 year. Lambda: Free tier for ever.
API Gateway: Free tier for 1 year.
Suitable for complex REST based Web Services and Web Apps. Suitable for simple web services and static Web Apps.
Best for demo or hobby use.
Not suitable for apis with low level dependencies.
No limitation on api execution time Lambda time limit: 15 minutes
API Gateway time limit: 30 seconds
Runs over http Runs over https
Restful APIs. Flask routing. Functions mapped as APIs Restful APIs. Flask like routing. Restful APIs. Routing in yml Restful APIs. Flask routing
Trivial stand alone APIs are not recommened. Advanced or complex or low level implementations are not recommended.