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!


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:

The TL;DR guide to git

While in the past I've held a pretty high opinion to using mercurial for version control, the majority of version control these days seems to done in git.  Here were the commands I found most useful to get productive with git right away. # Clone a repository from an origin, i.e. my github MaskingUtils repository git clone # Add a file after it's been updated to stage it for commit, or add a new file git add filename # Commit the file to local repo git commit # Push the file to the origin so the rest of the team can see it git push # List all locally tracked branches git branch git branch --list # Get a list of all branches from the remote git branch -r # Create branch locally git branch develop # Push the branch to the origin repository to make sure it is tracked there git push --set-upstream origin develop # Pulls latest from all local branches tracked from origin; won't pull non-tracked branches git pull --all # Fetch the branch