Skip to main content

AWS Development On A Budget

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
  • 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!


Popular posts from this blog

Software Design Principles - SOLID

The SOLID software design principles weren't called SOLID while I was in grad school, but the concepts were there in my Object Oriented Design course. They're worth mentioning here, primarily because I think once you start coding and become dangerous, it's one of the best ways to stay organized once you incorporate it into your daily coding routines, and it even changes your way of thinking for the better:

Matlab and MySQL

I had a lot of data in a MySQL database that I wanted to analyze. I had a copy of Matlab, so I figured the best way to look at this all would be to plot this data and use some GUI elements to go through various combinations. After some Googling, I found this database connector that seemed to do the trick. I downloaded the files, configured mex to use MSVC 2008, built the connector, then I was able to successfully connect over the network! I ran into two problems, though: The connector does not support fetching columns of type TIMESTAMP, and With the magnitude of data (about 180k rows), access times were really slow. I was able to solve problem #1 by changing my columns to DATETIME, which was supported. I'm still trying to figure out problem #2. It may come down to importing all the data directly into Matlab.

Rehashing C++ With Smart Pointers

Though I have seldom cared about using smart pointers these past three years (primarily because I work mostly with C, which can't support truly encapsulating smart pointers), I have tried to rehash my knowledge with Andrei Alexandrescu's tutorial here: [] I am absolutely astounded by the attention to detail in this article for something so simple as a single class with overloaded operators. C++ is a language that is not for the faint at heart, so this sort of article helps to navigate through the memory management limitations of C++. I should consider buying Andrei's book with the Eckel book to go with my Stroustroup and Musser books! Where's my amazon wish list...