๐ NodeJS With AWS in 1$/Month
2025-04-01
Optimize AWS Costs Under $1/Month with EC2 t2.micro and EBS GP3
Goal
How to run a Node.js application on AWS EC2 with costs under $1 per month?
System Configuration
- EC2 instance: t2.micro (Not using Free Tier, regular pricing)
- EBS (Elastic Block Store): GP3 8GB (Cheaper than GP2)
- Running time: 1 hour per day (10:00 - 11:00) using AWS Scheduler
- Operating System: Amazon Linux 2 or Ubuntu Minimal for resource efficiency
Cost Optimization Strategies
1. Use AWS Scheduler to Start and Stop EC2 Automatically
Since we are not using Spot Instances, we can schedule the EC2 instance to run only when needed.
Start Instance at 10:00 AM
aws ec2 start-instances --instance-ids i-xxxxxxxx
Stop Instance at 11:00 AM
aws ec2 stop-instances --instance-ids i-xxxxxxxx
To automate this, use AWS EventBridge (formerly CloudWatch Events):
- Go to AWS EventBridge โ Rules.
- Create a new rule to start the instance at 10:00 AM.
- Create another rule to stop the instance at 11:00 AM.
2. Use EBS GP3 (8GB) for small nodejs app
GP3 is cheaper than GP2, costing around $0.08/GB/month compared to $0.10/GB/month.
aws ec2 modify-volume --volume-id vol-xxxxxxxx --volume-type gp3
3. Limit Outbound Traffic
To avoid additional costs, minimize egress traffic since AWS charges for outbound data.
Estimated Monthly Costs
Item | Estimated Cost | Memo |
---|---|---|
EC2 t2.micro | ~$0.50 | 1h/day |
EBS GP3 | ~$0.24 | 8GB |
Total | <$1 |
Conclusion
With this setup, you can run your Node.js application on AWS for less than $1 per month without using Spot Instances or Free Tier. If you have any questions or suggestions, feel free to comment!