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

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: https://en.wikipedia.org/wiki/SOLID

Best Documentation of a Free Software Package

One oft overlooked artifact in software development is the documentation. An API that is not well documented is no API at all when time is of the essence. That's why I think it is important to discuss some of the tools I have used and their documentation. AutoIt - I love how you simply press F1 within the AutoIt editor and boom, the reference to the particular syntax or function pops up in the help window. This help file is well written, self-contained, and chock full of examples that can be opened up in the editor right from the help, a fantastic symbiotic relationship. After installing AutoIt and giving it a try using their examples, I was able to create client/server scripts, GUI scripts, and window management scripts in no time. Overall, AutoIt is tops in this competition. A+ MySQL - At the bottom of each page of documentation that discusses a particular statement, users are able to post comments containing code snippets for that particular statement. This is great..

Fun with MySQL + PHP

Lately, I've been getting a lot of requests to build websites driven by lots of data, so I've been reading heavily into MySQL and PHP. I've been relying "Beginning PHP and MySQL: From Novice to Professional, Third Edition" by W. Jason Gilmore. I was concerned with his use of connecting to MySQL with a plaintext user name and password, so I went through a few tutorials online: [hvassing.com] [studiolounge.net] and the SQL reference manual: [dev.mysql.com] Of course, they did the same thing. I'm working on trying to implement an SSL solution to login, but unfortunately I think it'll require an X.509 certificate.