Nowadays Amazon Web Services (AWS) leads in cost-effective business cloud solutions. With very flexible and wide-ranging pricing options, AWS allows effectively managing web hosting costs from the very beginning.
Allocating proper costs is crucial at the start of a project. But, budgets of completed products — whether website or web-based application — should also be reviewed and revised.
Below are several best practices of cost optimization that helped our clients reduce hosting expenses on live projects at Amazon AWS without loss of quality of their web-based products.
There are four main ways to analyze expenses and reduce them:
- Elimination of unused resources
- Optimization of resource usage by services
- Reorganization of infrastructure for efficient resource utilization without overuse
- Automation of routine jobs
Elimination of unused resources
When a project starts or when it’s being actively developed, a lot of artifacts are created and forgotten: disk snapshots, server images, outdated backups, etc. Some services could be tested and left unused for time. Despite the transparent billing, Amazon still bills you for services you own but do not use. It is all above board, though. Thorough analysis should be performed by a skilled engineer to reveal resources that a project does not, in fact, need.
Optimization of resource usage by services
Let’s say you have a highly available web application that uses load balancing and can automatically scale on events of increased load. But are you certain that it should scale as often as it does? Sometimes one or another service on the server is configured incorrectly or just can’t use all the resources that server provides.
For example, an application server that processes your website code is limited in resource usage by its configuration (i.e., it was left with default configs), so requests to your website are being queued when the number of visitors increases. That leads to slower response times (requests are waiting in queue to be processed). This might lead to auto scaling actions of your load balancer because the load balancer thinks the current number of servers cannot handle the load. Additional servers are then spawned increasing usage hours and increased costs.
Once, we had an already-live project where above-mentioned auto scaling occurred around 50 times per month. After our DevOps optimized the work of the project’s application servers, the number of auto-scaling events reduced to 4-5 per month — and only when real activity spikes happened.
Reorganization of infrastructure for efficient resource utilization without overuse
Sometimes servers are set up without a clear vision of how many resources the application really needs. It is difficult to predict at the beginning when a product is being developed. During the production stage, things become clearer and it’s possible to analyze resource usage. Therefore, to reduce unused resource and avoid wasting money, the right sizing of servers is crucial. With proper tools, AWS provides and your team’s wise approach, even production servers can be sized correctly with zero-downtime.
Another example of wise resource usage would be reserving resource capacity. A certain number of Amazon AWS hosting services have upfront payment options which greatly reduce annual (or semi-annual) costs compared to an on-demand model of payment.
Automation of routine jobs
Human error happens. Humans make mistakes and do not work for free. Human error sometimes cost a lot when they are made in a production environment. Juxtaposed to that, machines do not make mistakes (given the program code is good) and their running costs are lower. Check yours out: one or another routine process in an application lifecycle can be automated. And, if it can be, then it should be.
Automation of deployment or rolling out updates to a product (or any other process with a strict scheme of performing) can save a team a lot of time — and the owner money. With tools like Packer or Ansible — and the myriad other tools used in DevOps practice nowadays — a lot of things can be transferred to machine processing, ensuring each task will be performed on time and without human error.
In conclusion, the screenshot below shows a report diagram from the “Costs Explorer” service at AWS. It is a real example of how described practices reduced costs: from $5,200 in March to $4,200 in July.