Improve Planning and Cost Control with AWS Budgets
AWS Cost Management: Tagging
Understanding & Optimizing Storage Costs with AWS Storage Services
Monitoring for underutilized services in AWS
Using Instance Scheduler to Optimize Resource Cost
The course is part of this learning path
This section of the AWS Certified Solutions Architect - Professional learning path introduces you to cost management concepts and services relevant to the SAP-C02 exam. By the end of this section, you will know how to select and apply AWS services to optimize cost in scenarios relevant to the AWS Certified Solutions Architect - Professional exam.
Want more? Try a Lab Playground or do a Lab Challenge!
- Learn how to improve planning and cost control with AWS Budgets
- Understand how to optimize storage costs
- Discover AWS services that allow you to monitor for underutilized resources
- Learn how the AWS Instance Scheduler may be used to optimize resource costs
When you look at your AWS bill, you may find that compute costs take up a large percentage of that bill. The key to reducing this cost is to ensure you’re only using what you need - you don’t want to provision compute power that has more memory or more CPU than your workload requires.
This process of evaluating your resources and matching them to the appropriate compute type and size is called right sizing. It’s one of the more painful cost optimization exercises, because your environment is constantly changing and AWS releases new more cost-efficient options all the time. That means, even if you right-size workloads initially, your capacity requirements may change over time. And when things change, resources can easily get left behind and forgotten about - creating idle or underutilized resources.
So it’s important to have a process to right-size your instances, and also a monitoring strategy to prevent idle and underutilized resources from racking up unnecessary costs. The tools I’ll be talking about in this lecture help you do both. There are three main tools that can help with resource utilization: AWS Compute Optimizer, AWS Cost Explorer, and Trusted Advisor.
In this video, we’ll mainly focus on the first two services - AWS Compute Optimizer and AWS Cost Explorer. AWS Compute Optimizer tracks EC2 instances, Auto Scaling Groups, EBS volumes, and AWS Lambda functions. It then determines if you have underprovisioned these resources, overprovisioned them, or if your usage is optimized.
Underprovisioning means you haven’t given enough power in terms of CPU, memory, or network to your resources - thus, resulting often in poor application performance. Overprovisioning is the opposite, and means you’ve given too much power to your resources, which often results in unnecessary spend. And optimized, which means you’ve done everything right and can pat yourself on the back. You’re not over or under-provisioning these resources, and the specifications meet the requirements of your workload.
To form this opinion, AWS Compute Optimizer uses machine learning, and collects information on the past 14 days of resource usage from CloudWatch. For example, to form recommendations for EC2, the service uses CloudWatch metrics for CPU utilization, network packets per second, local storage throughput, and local storage IOPS as its dataset. For Lambda, it uses function invocation history, function runtime duration, CPU time used, and memory usage.
Once it determines you’ve overprovisioned, underprovisioned, or optimized your workload, you can view the findings in the compute optimizer dashboard. For each instance, it will recommend up to three other instance types that you can compare with your current instance type. It details cost differences and platform differences, in case it uses another hypervisor, storage interface and architecture, so you can compare the two instance types.
For example, let’s say you have a m5.xlarge EC2 instance and the service determines that your workload is “over-provisioned”. You can compare your instance to other instance types that provide similar compute power at a different cost. For example, the service may compare the m5.xlarge against an r5.large and a t3.xlarge. And from there, you can use that information to modify your ec2 instance type. Note that this service does not automatically execute the action for you. You will need to modify the instance yourself to match the findings.
Note that even if your instance is “optimized”, the service still may recommend other instance types that can create cost savings. I found this to be true when I specified a t2.micro, which was ruled to be optimized for my workload - however, the service recommended a t4g.micro and a t3.micro. I then changed my instance to use a t4g.micro, which uses Graviton2 processors, which provided significant savings over the other instances.
To get started with this service, you have to opt into it. Once you do, it will take up to 12 hours to generate recommendations for your resources and after that, it will refresh daily. This service is free, although there are paid features. For example, you can choose to activate enhanced infrastructure metrics, which is a feature that tracks the past 3 months of metric data instead of the default 14 days. And this feature does come with a fee.
AWS Compute Optimizer does have some limitations. For EC2, it only recommends selected EC2 instance types and families- not all of them. Take a look at the documentation for a full list of the instance types it supports. And for Lambda, it only makes recommendations if you have over-provisioned memory for your Lambda functions or if you have underprovisioned CPU for a lambda function. it will not make recommendations for other lambda functions.
Now, AWS Compute Optimizer is important, because its recommendation engine is used by other services as well. For example, AWS Cost Explorer uses it to provide right sizing recommendations. Because the engine is the same, this service analyzes the past 14 days of resource usage to recommend one of two actions: either modification or termination.
If the resource has lower than a 1% maximum CPU utilization, it detects it as an idle instance and recommends you terminate it. If the max CPU utilization is between 1% and 40%, it detects that it is underutilized and recommends a different instance type.
You may be wondering if both services use the same engine, do they produce exactly the same results? And the answer to that is no.
So when would you use each of these services? AWS Compute Optimizer is the more robust option of them both, as it considers disk and network I/O metrics and provides recommendations for EBS and Lambda as well. AWS Cost Explorer right sizing recommendations does not consider disk or network I/o and only makes EC2 recommendations. However, the one advantage Cost explorer has over AWS Compute Optimizer, is that it considers reserved instances and savings plans in its recommendations.
For example, if you have existing reservations, and choose to view all instance recommendations in Compute optimizer, it might recommend ways for you to save on costs. However, Cost explorer will take these reservations into account and you will see the true savings recommendation. So if Compute Optimizer says you can save hundreds of dollars, and Cost Explorer says you can save $0, it's likely that the instance is on a reservation or existing commitment. If you happen to see that, just realize that in these cases, Cost Explorer will provide a more correct savings amount than Compute Optimizer.
Both services are free by default, so it’s recommended that you use these services in combination with one another. This way you can get a holistic view of your savings when monitoring underutilized resources.
In Summary, Compute Optimizer helps you monitor for underutilized and overutilized resources, and provides recommendations to right size instances and reduce costs, while Cost Explorer Right Sizing Recommendations also helps you monitor for underutilized resources and suggests modifications and termination, while taking reservations into account.
Danny has over 20 years of IT experience as a software developer, cloud engineer, and technical trainer. After attending a conference on cloud computing in 2009, he knew he wanted to build his career around what was still a very new, emerging technology at the time — and share this transformational knowledge with others. He has spoken to IT professional audiences at local, regional, and national user groups and conferences. He has delivered in-person classroom and virtual training, interactive webinars, and authored video training courses covering many different technologies, including Amazon Web Services. He currently has six active AWS certifications, including certifications at the Professional and Specialty level.