I was interested in hosting a small portfolio of applications in AWS, but I wanted to keep costs down. I was willing to maybe host about $30-$40 a month of servers just to showcase some of the applications I was putting together. Here's what I came up with.
The basic capabilities here were:
- serve up about 6-10 applications that would require some level of web application hosting, database, file storage for larger items, and possibly queuing or email
- schedule jobs to run periodically to either scrape websites for new data or access APIs regularly
These were the services in mind, all out of US-East-1 (Virginia):
- EC2 instances are pretty cheap. You can run a t3a.nano for about $3.38 a month, or a t3a.micro for about double that for $6.77. The more things can run on one of these instances, the better.
- Lambdas also don't really add up to much if they are scheduled jobs that do not consume large amounts of memory or computing.
- The cost of a Lambda run as part of an API gateway could be controlled as pretty small if a private VPC endpoint is created for it, and
- a Lambda run once a week as a job would be almost negligible.
- If a Lambda does need to access an external website or API then it will require a NAT gateway and a subnet to run it in. The NAT gateway runs at about $32.40 a month; that would take over the majority of my costs but would allow for these external accesses.
- RDS Aurora MySQL instances for database run at about $29.52 a month; even if I were to shut it down for 1/3 of the day (sleeping hours let's say, midnight to 8am) it would be about $19.68 a month. This is a bit too much for me
- Elastic Load Balancers (for providing redundancy and hosting certificates) run at about $16.20 a month, so scaling those out to 6-10 applications would be difficult for me
- S3 storage is cheap, so that can definitely be an option for static media, files, and even an entire marketing-type website
Conclusion:
- I decided to host the three tiers of the application on a single instance EC2 each:
- the web server (nginx or apache with certs by let's encrypt),
- application frameworks (nodejs or Java Spring Boot), and
- database (mariadb and postgresql) all on the same instance
- For the jobs, I really liked the idea of running Lambdas and Step Functions that needed to access the Internet, so I decided to pony up the majority of my costs on the one NAT
Final costs: $32.40/month on the NAT, plus between $3.38 and $6.77 per EC2 instance which I will shut down overnight as the number of apps I create increases.
This doesn't include one-time and recurring fees for the domain names, so it should be assumed another dollar a month for that, but overall I should be able to get in under $50 a month for the whole caboodle. Not bad!
Comments
Post a Comment