Cloud computing cheat sheet
When you start with a cloud provider it’s easy and straight-forward. You pay for what you use.
But as you start scaling, maybe have a number of developers or even several accounts, it’s hard to keep track of your expenses and as we know the biggest chunk of the bill at the end of the month is usually the computing section.
l laid out the most fundamental best-practices to optimize you compute resources and maybe even leave you with a few spare bucks in your pocket.
The aim of right-sizing is to match instance size and type to your workloads and capacity requirements at the lowest possible cost. It is also aimed to identify opportunities to eliminate, turn off idle instances and right-size instances poorly matched to the workload.
How do you choose the right size?
You can do this by monitoring and analyzing your use of services to have an insight into performance data then locate the idle instances and instances that are under-utilized.
When analyzing your compute performance (e.g. CloudWatch), two key metrics to look for are memory usage and CPU usage.
Identify instances with a maximum memory and CPU usage of less than 40% over a period of four weeks. These are the instances you would want to right-size to reduce cost.
** Pro tip: create alarms to get notified when your utilization is low or high so you can have your finger on the trigger at any time.
Compute workloads vary over time making it difficult to predict, but in most situations, we can predict the “minimum” capacity that we’ll need for a long period of time.
Amazon Reserved Instances / Azure Reserved VM Instances allow you to make-instance workload reservations for workloads like these.
Reserved Instance pricing is calculated using three key variables:
- Instance attributes
- Term commitment
- Payment option
Instance attributes that determine pricing include instant type, tenancy availability zone, and platform.
To illustrate, purchasing a reserved instance with instance type m3.xlarge, availability zone us-east-1a, default tenancy, and Linux platform would allow you to automatically receive the discounted reserved instance rate anytime you run an instance with these attributes.
Reserved instances can be purchased on either 1 year or 3-year term commitment. The 3-year commitment offers a larger discount.
By using Reserved Instances for these workloads you can save up to 60% when compared to standard on-demand cloud computing pricing.
Having said that, it is important to state that purchasing and managing reserve instances requires expertise. Purchasing the wrong type of instances, under-utilization or other such mishaps, may end up increasing your costs, rather than reducing them.
Spot instances are an excessive capacity of computing in a region, that are priced as low as 90% off the on-demand price, but with a catch:.
Spot instances are subject to interruption, meaning that you should not use spot instances for long-running mission-critical workloads.
So, how does that work? You bid for the number of EC2 instances of a particular type you wish to run.
When your bid beats the market spot price — your instances are run. The current spot price is determined by supply and demand.
When the current spot price increases above your bid price, the cloud vendor reclaims the spot instances and gives them to another customer.
Spot instances can be a cost-effective option for short-term stateless workloads.
Instead of paying for servers that are idle most of the time, you can consider moving to on-demand serverless services in the form of
Event-driven compute service.
Although not suitable for all businesses’ needs, for many developers serverless computing offers a number of advantages over traditional cloud-based or server-centric infrastructure, such as greater scalability, more flexibility, and quicker time to release, all at a reduced cost.
In a serverless environment, You pay only for what you actually use, as code only runs when backend functions are needed by the application, and scaling up is automatic on need.
We all know the situation that we set up a server in our development environment only to find out after returning from the weekend that we forgot to turn off the machine.
You can save around 60% on running these instances if you maintain an “on” schedule on prime operation hours. If your teams work irregular hours/patterns and you adjust your on/off schedule accordingly — you can save even more.
You can save even more by utilizing measures to determine prime-time usability or apply a schedule that is by default stopped unless interrupted upon the need for access.
Single cloud vs. Multi-cloud
A multi-cloud environment certainly has its drawbacks, from complex infrastructure, through central visibility, but a well-planned multi-cloud strategy can lead to great cost savings. E.g. Different prices for the same instance types and numerous spot markets.
Having said that, volume-related perks when spending with a single cloud vendor are not to be overlooked either. Weigh the pro’s and con’s of your cloud environment needs and capabilities, and you can benefit significant savings with one or the other.
Update your Architecture regularly
Cloud environments are dynamic, new products and services are released regularly.
There is a good chance you can harness this new Serverless service or Auto Scaling group feature to better utilize your workloads or remove overhead from your developers while minimizing costs.
Optimizing your cloud cost is an ongoing process. You constantly need to monitor the services you use and the computing power you need to effectively leverage the excess capacity or unused EC2 instances to benefit from significant savings. It’s important to set in place real-time monitoring tools that will enable you to stay on top of your infrastructure performances and utilization.
To learn more about Cloud Optimization, or just get some expert advice, we’re a click away.