How do we cut down our client's hosting cost for one app from $100/month to $10/month?
They host a number of mobile applications, which have a typical 3-tier architecture: a front-facing mobile, an API application, and a database. Previously, this monthly AWS bill came to just over $100 per month:
BEFORE
Here is a list of simple tricks you can try for your web application to cut down on hosting costs:
- Choosing a better EC2 instance. If you use an EC2 instance, you can upgrade to higher generation tiers (the latest is the T3 tier). We upgraded the T1 tier to T3 and moved from the "medium" type to "nano". The performance improvement from T1 and T3 is so significant that T1.medium is faster than T3.nano. However, the monthly cost is reduced from $36 to $3.
- Not using RDS instances. If you don't have a high-load application but rather have 200-300 users daily, you can get rid of your RDS instance. This will immediately save you $19.80 per month. Of course, don't delete the database entirely since your application relies on it. Instead, move it under... yes, same EC2 T3.nano instance. To do that, you have to install the database server right on the instance itself. Although the instance only has 500MB of RAM, you can create a swap file that is 3-4 GB in size. It would be sufficient to have the web servers and databases on the same instance for low-load applications.
- Reducing the snapshot storage size. HDD, or snapshot volumes, also costs some cash. In our case, we had 124GB of total capacity but were barely using 20% of it. We decreased the capacity to 25GB, which dropped the price from $13.52/month to just $3.49/month.
- Cleaning up other unused instances. It is a great idea to review your resources monthly and decide which can be deprecated (such as storage, snapshots, or services). Very few of these come free with AWS.
We measured the performance of our servers after completing all of these steps, and it had improved. Reduced costs, improved performance! Woohoo!
AFTER
Additional steps.
You can get a yearly savings plan to drive down the cost of the EC2 instance even further (to somewhere around $2/month).
Keep in mind that all these optimizations work for low- to medium-load applications. You should also have a plan in case the load increases significantly once the app or website grows:
- Create a load balancer (approximately $14/month) and create multiple instances behind it using the same t3.nano instances at $3/month each. Depending on the application load, we may want to create 2-3 (or more). Even if we create 5, this will only drive the cost up by $14 + ($3 x 5) = $29 per month. It's not a big deal.
- We might want to move the database to RDS. This will raise the cost by $19.80/month or more, depending on how powerful the RDS instance needs to be.
AWS has great flexibility and provides a lot of benefits for companies. But without proper resource management, it's easy to go over budget. This is especially true when you have an enterprise-grade architecture with hundreds of instances, components, and services. It is always best to trust a team that can help transparently optimize your resources and save you up to 90% on your cloud services.