Cost Control in AWS

This information is provided by our friends at VictoryCTO – specialists in Digital Transformation in AWS.

The cloud represents massive change: it comes with the promise of unlimited resources, low hourly rates, and few barriers to entry.

This also requires a change in the way you think about architecture and cost. In a private datacenter (remember those? I used to keep socks and earplugs in my bag at all times), cost changes come in large chunks: $200 / month to lease a new server, $2000 / month for another cabinet, etc. – and those costs are reviewed by finance then signed off by the CEO.

Not so anymore. AWS charges vary from by-the-hour for a server, down to by-the-millisecond for a serverless function, plus reserved instances, spot instances, storage, networking, and more. This complexity is enough to make an MBA bleed from the ears.

There still needs to be management of these costs, and with the greater complexity comes the greater chance that mismanagement will happen. It’s all too easy to reach the point of “death by a thousand cuts”.

Because we work with a vast variety of companies here at Victory, we see some patterns emerge in how people primarily mismanage their cloud costs. In this article we’ll just be concentrating on AWS, although Google Cloud aligns nicely as well.

Generally companies:

Use the cloud like it’s a bare metal datacenter

Incorrectly calculate auto-scaling

Set it and forget it

Use AWS like it’s a datacenter: When people first move to AWS, they tend to copy exactly what they had in their datacenter – server for server, spec for spec. While topic is an entire article on its own, the short version is: don’t do that! Get a cloud architect to help you in the migration and use this opportunity to create your cloud datacenter specifically for the cloud.

Incorrectly calculate auto-scaling: When you take advantage of cloud functionality – like automatically launching new machines based on load or serverless processing – you run the risk of over-scaling.

This is a place where your application and infrastructure need to understand each other – if a runaway process hits, and is replicated to every machine, you can, in theory, add machines until you’re bankrupt. Or the CFO comes and yells at you a lot. Both bad.

Set it and forget it: This is the most common thing we see. Someone manually spun up some infrastructure to “test” or “try” or “evaluate”, and it never went away. Yet more small cuts that add up to a big bill.

What is AWS Cost Management?

Here’s a fun exercise – Google “AWS Cost Management” – you’ll get 5 paid results every time. This is a big business, but before we get into the paid tools, let’s talk about the basics.

AWS got smart and put some boundaries in place to keep you from running up a crazy bill on accident. You have to ask permission before you can turn on more than 20 servers, or use 5 elastic IP addresses, or more than 5 VPCs – everything that costs money now has limits.

They quickly lift the limits for you with a support request, and they are there to protect you. That’s the good news – there is some cost management inflicted on you even if you don’t want it.

AWS has a cost calculator – use it to estimate what your bill should be. Overestimate anything that’s not straightforward (like bandwidth). Track that number on your monthly bills. AWS also has a real time tool to estimate your bill BEFORE the month is over. This is available in the console – look for AWS Cost Explorer. Set a budget: AWS has an in-depth budgeting system – you can track your budget on a large scale, or by individual service. You can set up alerts based on actual or forecasted budget. They have a nice article on their tools here .

AWS Cost Explorer: see your costs to before they go too high

How to keep costs down in AWS:

Think like a cloud architect: In the cloud, you can get more resources in seconds – even without automation – so start small, with smaller or fewer servers. If you have any doubts, take an hour to talk to an experienced cloud architect and ask some questions or double-check your plan.

Monitor everything: AWS CloudWatch is a nearly-free service (you only pay for disk storage) that can track and log anything in AWS. Combine that with a good notification service like PagerDuty and you could set up an alert that tells you the moment spending starts to get out of control.

Auto-scale: Is your app busier during the day versus the evening? You can cut down the number of servers used based on network traffic, server load, or simply by the hour.

Go serverless: Many apps now can be built entirely serverless, and you can be billed by the millisecond.

Third-Party Cost Management Tools We Like

At Victory, we aim to help our clients with their challenges and set them up for success, not to manage their clouds for them long-term. Because of this, we like to standardize and try to do as much inside the “ivory tower” of AWS as possible.

That said, we use a number of helpful tools to plan and monitor.

Cloudcraft.co

Cloudcraft is a neat tool that will help you design and monitor your cloud. In the architectural stage you can lay out your needs and see what the real cost will be – you can also stay on and Cloudcraft will provide a real time visualization of the real infrastructure as well as any problems in your stack.

Datadog

Datadog is a fantastic general tool for monitoring your infrastructure, and it can monitor and alert on cost as well. We often bring Datadog in when a client has a resource problem, as the advanced application monitoring tools can show where code can be optimized and how it interacts with infrastructure.

In Conclusion

Cost Management, whether in the cloud or for any other part of your business, is a complicated subject. It’s often ignored until it’s a problem.

To stay ahead of it you should:

Plan your cloud architecture with a cloud architect.

Start small and add on more as needed.

Monitor everything and make sure those monitors send you alerts.

Take advantage of cloud tools like Serverless infrastructure and Auto-scaling.

Author: John Cunningham, Co-Founder and CTO, Victory

John Cunningham is a veteran entrepreneur with three successful startups under his belt specializing in operations while building and delivering large-scale, high-availability consumer-facing applications. He’s currently co-Founder and CTO of Victory, a business transformation consulting agency. Victory has faced a few interesting challenges – from building an entire business and app from scratch (the founder had a powerpoint, an idea, and a million dollars) to helping one of the world’s largest gaming companies migrate to the Cloud. He also is a brisket enthusiast and trains service dogs.