AWS cost optimization deep dive
An introduction to AWS cost optimization tools and strategies to help you save money and make better decisions!
Jun 08, 2023 • 9 Minute Read
Hey there, Gurus! Let's talk about the cloud for a moment. We know what it is, and that most businesses already have, or are planning to migrate their infrastructure to the cloud. But today, I want to talk about a crucial aspect of the cloud: cost. As the saying goes, money talks. In this article, I’ll cover the types of costs associated with AWS, and introduce you to some of the handy AWS cost optimization tools and services that will help…well, optimize your costs!
What is cost optimization in AWS?
Let’s first start with understanding what cost optimization means and why it's important.
Cost optimization is all about getting the most value for money in your cloud spending. By considering what business value we need from a solution, we can design it to reduce our costs, and continuously review it to find ways to continue reducing costs over time. This can bring down our monthly bills, and also brings in new opportunities to invest in other areas!
Knowing how to cut costs and maintain optimal costs as your workload evolves is the key to cost optimization.
AWS Free Tier
Most of the popular AWS services have a free tier that can be used when you are first starting out. The free tier is often generous enough to provide you with quite a bit of a buffer as you start building out production workloads.
AWS Pricing Calculator
A great AWS optimization tool that can help you get an estimate of your costs, before you even start incurring fees, is the AWS Pricing Calculator. When using the pricing calculator, make sure you gather as much usage data as you can to ensure that your estimate is as accurate as possible. If you rush through the estimate with little to no information, your costs could end up varying wildly from your estimate, so take the time and do your due diligence.
The AWS Well-Architected Framework
AWS knows how daunting using the cloud can be and has a framework in place to help guide how you build your environment. This is known as the AWS Well-Architected Framework and it comprises six pillars: Operational Excellence, Security, Reliability, Performance Efficiency, Cost Optimization, and Sustainability. Each pillar has its own design principles that break it down into easy to understand pieces.
For today, and in keeping with the theme of this article, we’re naturally going to be focusing on the Cost Optimization pillar. Let's shine a light on the five design principles of this pillar.
The five principles are: practice cloud financial management, expenditure and usage awareness, cost effective resources, manage demand and supply resources, and optimize over time. Each of these 5 principles each have their own best practices to keep in mind.
We can drill down a bit more into these five principles.
Let's start your AWS journey
Ready to level up your AWS skills? Whether you're just starting out or a seasoned cloud pro, A Cloud Guru's learn-by-doing approach will help you master the cloud and advance in your career.
Practice cloud financial management
Part of the transition from a traditional on-premise computing model to cloud computing is moving from Capital Expenditure (CAPEX) to Operational Expenditure (OPEX). Instead of just buying expensive hardware and using it as much as we can, everything has a cost. This means we need to treat it that way, and reorient how we think about Financial Management.
This would include budgeting, reporting, quantifying business value, and staying knowledgeable of updates in AWS. Using services like Cost Explorer can be helpful to review costs and usage, and obtain forecasts of both. Using that information to see where your costs or usage are peaking can help you shift your focus to find a more cost-efficient way to use specific services or workflows.
Having a culture of cost awareness in your teams helps embed good practices in a scalable and organic way across your organization. You can take that a step further by using automation and forecasting to cut costs overall and free up your team to focus on other important tasks.
Expenditure and usage awareness
Even though we’re incurring costs, it’s hard to know exactly where, and how much. Having detailed awareness is a big part of the puzzle when it comes to optimizing costs in AWS. AWS Control Tower, Organizations, and IAM manage control access and can help you to consolidate and manage billing in a holistic and centralized manner.
You can also use Instance Scheduler with tags to start and stop EC2 and RDS instances, and to decommission resources. If you know what your peak hours of usage are for your EC2 instances, consider using the Instance Scheduler to stop instances that are not being used in order to cut your costs. If your usage is spiky, but you want to optimize when your instances are running, consider using auto scaling groups to manage when the instances scale out and back in automatically.
Cost effective resources
Cost effective resources are your bread and butter when thinking of cost optimization.
In order to be cost effective with your resources, you must understand your use case. Evaluate what your needs are and then explore the associated costs. Instead of using traditional virtual machines with EC2 instances, your use case may support extremely cost-effective serverless solutions like AWS Lambda, or container-based solutions using ECS or EKS (we even have a blog post explaining serverless vs containers in more detail). Or you may go one-step further, with a fully managed solution, like RDS, removing the need to manage your database servers.
Knowing how to optimize your EC2 instances will save you money in the long run, too. Storage can be a money-hungry monster, but effective S3 usage can help curb costs. When considering the costs of your resources, understanding how the pricing works for that specific service will go a long way. Always do your due diligence and research where charges are being incurred.
Knowing how your data moves can help you keep an eye on data transfer costs. Data transfer costs are frequently overlooked. Optimize your network costs for data transfer by selecting the correct services and implementing the most suitable architecture for your use case. For example, traffic that needs to be transferred across different regions will usually incur a data transfer charge. Consider if this is something your business really needs.
Start building your cloud skills with these 10 fun hands-on projects to learn AWS.
Manage demand and supply resources
The ‘manage demand and supply resources’ principle focuses on understanding how your workload is received and handled.
Throttling and buffering are ways you can implement different demand styles and each has its own pros and cons. Understanding your use case, and which resources can be used to provide the best supply base for those needs, can keep your costs from getting overwhelming when things do not go as planned.
For certain intermittent workloads, serverless solutions may be the best fit to your needs, only executing as required. In other cases, you may prefer to use auto scaling features like those provided through AWS Auto Scaling to manage your resources for you.
Optimizing over time
Optimizing over time is the frosting on your delicious cost cake. When you’ve reached this point – congratulations! Your foundation and all the important bits are in place, like the base layer of sponge in a cake. But with your workload evolving and changing over time, the work is never really done. Services like CloudWatch, CloudTrail, Trusted Advisor, and Config provide you with the visibility and tools to continually review and audit your workloads, and help you maintain optimal conditions on your spend.
For example, let's say that you start a home business called Flying Bears Inc. Your business creates and sells artwork of flying bears around the world. All of a sudden, business takes off when some of your work is featured in a movie. Your resources need to scale out to handle the new increase in requests, and you might need to consider expanding those resources across regions to allow people to view your work worldwide.
Using dashboards in CloudWatch can help you see how much your usage is growing and which resources have the most usage so you can get a plan in place to scale that resource specifically. Use Config to save and audit all of your configurations to ensure that they are being used consistently and matching the desired configurations for every new resource launched.
Your use case may also change over time as well. Using EC2 Instances with On-Demand pricing may be economical at first, but as your load increases, you may opt to start using Reserved Instances or Savings Plans. Likewise, as your solution ages, incurs less active users, and doesn’t need to scale as often, switching back to On-Demand instances may actually save you money!
Are you looking to begin your AWS career or take your skills to the next level? Our AWS learning paths offers customized paths to excel your cloud journey!
Cost optimization doesn’t have to be costly
The cloud can feel as challenging to navigate as an old-growth forest, and cloud costs can feel a bit like a big, scary beast - ready to rear its head and take you by surprise. But it doesn’t have to be this way; AWS has services that can help prepare you and your team for costs both expected and unexpected, and to put best practices in place to avoid the latter.
This article merely scratches the surface of all that is necessary to understand the principles of AWS cost optimization. So if you want to dive deep into these topics, check out my AWS Cost Optimization Deep Dive course.
Use the hands-on labs to practice some of the ideas covered in the course in real-world scenarios. At the end of each section, there are also handy quizzes to test your knowledge as you progress through the course. And, when you’ve completed the course, join me in a celebratory dance!
Thank you for hanging out with me today, Gurus. Deep breaths, baby steps, and remember to keep being awesome!