Managing AWS EC2 Costs with AWS Tools: A Practical Guide
Learn how to effectively manage your AWS EC2 costs using AWS tools with this practical guide. Discover proven strategies for cost optimization and take control of your EC2 expenses today.
AWS EC2 at a Glance
Since AWS started, Amazon’s Elastic Compute Cloud (EC2) has been one of the most popular services. Infrastructure-as-a-Service (or “IaaS”) bedrock is where many customers start their journey into the cloud. This is partly because it is familiar (EC2 instances are often managed and treated like the cloud version of on-site Virtual Machines) and partly because having such a low-level of control over size, speed, and configuration grants power and flexibility. Because EC2 instances are so popular, they are usually the most expensive part of a company’s AWS bill.
In this article, we’ll talk about the AWS tools you can use to understand how you use EC2 and keep your spending under control.
Measuring Costs in AWS
One important part of running a business in the cloud is keeping an eye on and taking care of costs. It’s hard for companies to keep track of their costs. AWS’s own survey from last year shows that 81% of customers think they spend more than they should on cloud services, anywhere from 25% to 200% more than they expected.
Customers are usually so focused on building their infrastructure that they miss the important step of finding the right balance between price and performance. This is especially true for customers who are used to working on-premises, where the goal is to have a lot of extra processing power. Things are different in the cloud. We don’t want our instances to have more processing power than they need. Finding the right balance is what cost management is all about.
The customer is charged for everything in the cloud using a utility model. That is, if you run an instance for three hours, you will be charged three times its hourly cost. And the price is different for each type of case. In general, as the size of the instance grows, the price doubles. Let’s look at the table with the sizes of the T family and how much they cost per hour (all prices are for the US East):
Because of this, it is very important to make sure you have the right EC2 instances running. Companies often have instances that are too big or the wrong kind, and sometimes they have instances that are turned on but have been forgotten about. Even though these things still cost money, they don’t help with production in any way.
Keep in mind that the prices above only include the cost of the IaaS instance itself. There are always extra costs when you use an On-Demand Instance or a Reserved Instance. You have to pay for a licence to use Windows. If you need more room, you’ll have to pay extra for it. Both storage and networking will have IO costs. All of these have different levels of service that need to be taken into account when figuring out how much a running instance will cost in total.
AWS EC2 Cost-Saving: Exploring Alternatives to On-Demand Pricing
In the example given above, only the prices for On-Demand are shown. This is the standard way to charge for use, and this is how most people think of cloud costs. On-Demand is a great way to start because it gives you a lot of freedom. There are a number of other ways to pay for your instances on AWS. These include Scheduled Reserved Instances, Reserved Instances, Spot Instances, and Savings Plans. Depending on how you use them, you could save a lot of money.
Let’s start with Reserved Instances, which is the most common alternative to On-Demand Pricing.
Reserved Instances
Need a t2.xlarge to run for only 3 hours a week? Excellent. On-Demand pricing will help you a lot because it will only cost you about $1.50 per week. But what if that instance needs to be running all day, every day? This can get pricey very quickly. A Reserved Instance is an alternative way to pay for an instance on AWS.
If you know your workload is stable and full-time, you can pay AWS in advance to rent an instance size for 1 or 3 years. So instead of paying by the hour for that t2.xlarge, you would pay once and not be charged again until the lease is up. You also save money in the long run with a Reserved Instance. Since you pay the full price up front, AWS gives you discounts compared to what the annual cost would be for an On-Demand instance.
For example, it would cost about $1,625.88 to run that t2.xlarge in an On-Demand pricing model for a full year. The price drops to $939.95 for a 1-year Reservation, and it would cost $1,834.34 for a 3-year Reservation, or $611.45 a year.
As you can see, this is a big way to save money. They are only worth it if you know your workload will be stable during that time, so it is important to know how much work you have.
Scheduled Reserved Instances
There are also Reserved Instances that are scheduled. These are very similar to standard RIs, but you can only schedule your instances to run at certain times of the day or week. This would be great if, for example, you had a batch job that needed to run after hours but didn’t need the instance to run during the day. You could set up a Scheduled Reserved Instance that would only run from 8pm to 5am. This plan saves you even more money than a regular Reserved Instance because you don’t run the instance all the time.
Spot Instances
Reserved Instances not only save you a lot of money, but they also guarantee performance because the EC2 capacity is set aside for you. Spot Instances, on the other hand, don’t require any kind of long-term customer commitment like Reserved Instances do. Spot Instances are great for batch-style work that can be done in the background. When EC2 has space, the jobs will run.
The amount of unused EC2 capacity in AWS changes over time, and the Spot Instance model lets you bid on that unused EC2 capacity to run jobs that only need to be done for a short time. Prices for Spot Instances are available to the public and vary by Region and Availability Zone.
Spot Instances shouldn’t be used for time-sensitive or business-critical tasks, because your instance can be shut down if EC2 capacity is needed elsewhere. Spot Instances, on the other hand, can be up to 90% cheaper than On-Demand pricing for the time that your instances are running.
Here’s an example using the t2.xlarge instance, running in US East:
Savings Plans
Savings Plans are interesting because they don’t try to save money in each individual case. Instead, they look at how much you expect to use it over a year or three years. This is based on how much money usage adds up to as a whole. Because of this, Savings Plans are also more flexible. There are plans that are specific to EC2 Instances, but there are also more general Savings Plans that can be used with external services like Lambda and Fargate. Here’s an example from the AWS Savings Plan documentation of the savings that these plans can give you:
Let’s look at a few more ways to keep costs down by using tools that AWS provides.
Best Practices for AWS EC2 Cost Control
If you don’t want to waste money on EC2 instances you don’t need, you have to keep an eye on them. You should have a process that all employees must follow for setting up, using, and shutting down EC2 instances. Without a process, it’s too easy for big or unnecessary cases to keep running and cost your business money.
Know What You’re Paying For With AWS Pricing Calculator
Please remember that all of the prices mentioned in this article, including these, change over time. Changes can happen from one month to the next and from one place to the next. Check the AWS Pricing Calculator and the pricing pages for each service to make sure you fully understand what you will be charged for and why.
Dynamically Organize Your EC2 Instances Using Tagging
Amazon’s best advice in this case is simple: “Tag early and tag often.” When you set up an EC2 instance, you can add tags to it. These are simple text metadata that describe the instance in any way that makes sense. To make a tag, you need to do two things. The tag’s key and value. You could, for example, label a new machine. “Department: Engineering,” “InfrastructureEnvironment: Development,” “UseCase: Internal-Only,” “Owner: ExampleUser123,” and so on. Then, you can use these tags to group EC2 instances so that you can keep track of costs and manage them. Auto-tagging can be used in more advanced AWS environments to apply tags based on rules like username or resource group.
Monitor your EC2 instances with CloudWatch
With the AWS tool CloudWatch, you can keep an eye on your instances. It is a platform for monitoring that is built into AWS. It can keep track of a wide range of metrics, such as CPU, network, and disc usage, as well as log changes that can be used to send alerts.
CloudWatch also has an Agent that can be put on running instances that support it. This lets you get more system-level information from the instance, such as how each application is used, custom metrics, and system logs.
Then, you can use all of this information to figure out how healthy your cases are. From the point of view of managing costs, this is helpful. If you use tags well, you can sort that data to make sure, for example, that instances aren’t too big or aren’t running when they shouldn’t be. By using tags, you can also group and organise your instances by application, business unit, owner, etc., and only send alerts to the people who need to know if something is wrong.
Set Up Your Environment For Expected Spend Using AWS Budgets
Budgets is meant to keep an eye on how things are being used, while CloudWatch is meant to keep an eye on how things are running. Tags or the location of infrastructure can be used to set up budgets, so you can set up budgets for individual instances, groups, business units, projects, or any other meaningful identifier. These budgets can be set up quickly for situations that come up often by using a set of default templates. You can then change these to meet your needs.
The Budgets service can be set up to just monitor and send alerts via email or AWS Chatbot (useful for sending messages to Chime or Slack), or you can set up your own automations that are triggered by a message from SNS.
For example, if you don’t want to spend more than $100 on an instance in a development environment, you could set up AWS Budgets to send you an email when the usage reaches 80% and stop the instance from running when the actual usage reaches 100% of that $100 budget. There are also built-in options, such as adding IAM or Service Control Policies. If you want to do something more complicated, you could set up the alert to trigger a Lambda function that does whatever you want it to do in your environment.
Export Your Full Usage Data Using AWS Cost and Usage Reports
The AWS Cost and Usage Reports feature is easy to use and lets you automatically export your raw AWS usage reports to an S3 bucket. Each line in the report shows the product used, how it was used (and therefore billed), and how it was used in your AWS account. You can look at the report by hour, day, or month. Also, since these reports can be exported, they can be used in other business intelligence tools like Tableau or PowerBI.
These reports are very helpful if you need to be more thorough than the built-in tools allow. If you have the time and tools to use it, CUR can give you all of your data from the beginning of your time with AWS. As you’ll see, other tools for controlling costs and making a budget will only work for a limited time. For example, Cost Explorer only works for the next year. If you want to change data that is older than that or you are using tools from outside, you will probably want to start by exporting a CUR.
Review Your Environment Using AWS Trusted Advisor
The AWS Trusted Advisor is another built-in service that gives customers tips and best practises based on what it sees running in their environments. (Note that Trusted Advisor looks at a lot more than just “Cost Management,” but for this article, we’ll just talk about these features.)
From the point of view of Cost Management, it can look at all the data it has (including plugins to other AWS services like CloudWatch) and make suggestions based on performance and usage, such as changing the size or type of an instance, using Reserved Instances, or even turning off or deleting instances that aren’t being used. Trusted Advisor can be used to check in now and then, or it can be set up to send emails when best practices are updated or when new recommendations are available.
Evaluate Your Spend Using AWS Cost Explorer
Cost Explorer’s main goal is to help you understand your costs. AWS Trusted Advisor, on the other hand, is a more comprehensive tool that gives advice for your whole infrastructure. Like Trusted Advisor, Cost Explorer lets you make visual representations of your instances and their costs, which can be sorted and grouped by tags if they are available. Cost Explorer goes one step further, though.
Cost Explorer can make predictions, among other things. Cost Explorer can project data from the past into the future, so you can see what your costs might be like if nothing changes.
Cost Explorer can also show patterns of use by giving details and analyses based on the data it is given. This can help you figure out, for example, what systems or applications are the busiest at what times, so you can make sure that the instances are on when they are needed and off when they aren’t.
Cost Explorer also has a very useful feature called Cost Anomaly Detection. As the name suggests, it helps users find strange patterns in how they use AWS by looking at data from the past. Cost Anomaly Detection uses cost and usage data to set baselines and expected usage, and it alerts you to things like spikes or new cost centres that aren’t part of more normal cloud usage patterns.
Cost Explorer may be most useful for its “Cost and Usage Reports” feature. This can let you simulate how demand changes or how resources are added or taken away. This helps you not only figure out how much it costs now, but also how much it will cost in the future based on a number of different possibilities.
Through the AWS Billing Console, you can get to Cost Explorer. It is meant to help you get the information you need quickly by giving you predictions that have already been made. All you have to do to use it is turn it on. It’s important to remember that the ease of use comes at a cost: Amazon says that these already-made forecasts have an 80% chance of being right. You can’t change the settings to get higher numbers, and the tool won’t give you any predictions if you don’t have enough information to get to 80%.
Perform Custom Business Intelligence And Planning Tasks With Amazon Forecast
Amazon Forecast does things that Cost Explorer can’t. Forecast is not a solution that you can just click and go with. Instead, it is a fully managed service based on machine learning that requires the user to set up a lot. Before Forecast can make predictions, the user will need to prepare the data, set up the model, and check that the predictors are correct. Most of the time, users will set this up as an automated pipeline that pulls data from AWS Cost and Usage Reports, modifies it as needed for Forecast, and then stores the results in a separate S3 bucket.
The Forecast console can then use this information to give users any number of insights they have asked for. You can do everything you can do in Cost Explorer in Forecast, but you can choose how accurate you want to be. You can also make your own models in Cost Explorer that aren’t included in the ones that are already made.
As you might expect, there are some downsides to using Forecast. The most important problem is how long it takes to set up. Even Amazon says that setting up this tool takes a “long” time. You’ll also need a team of AWS experts who are good with numbers. In Cost Explorer, the user builds everything. In Forecast, the user builds everything. This means you will have full control over the output and can get exactly the data you want, but you will have to build and maintain it. Also, because this service is based on Machine Learning, it costs more to set up and train, making it a more expensive option than Cost Explorer.
Be Aware: The Hidden Costs of Cost Management Tools
There is no extra charge for any AWS customer to use these tools. But you should remember that this doesn’t mean they are free. Even though the services are free, you may still have to pay for them depending on how often you use them. Let’s look at CloudWatch to see how much all of this costs.
CloudWatch charges both by the number of requests it gets and by the amount of data it takes in. The information that CloudWatch gives you will cost you in the following ways:
Both Trusted Advisor and Cost Explorer have costs that are similar and should be thought about.
AWS EC2 Cost Management: a Better Approach
Forma Cloud’s team of experts has developed “Optima”, a tailored solution designed to address the specific needs of our customers. Explore the remarkable capabilities of our comprehensive cost-saving offerings:
Instance Downsizing
Optima optimizes resource allocation to align with the current workload, resulting in efficient utilization and significant cost savings. By scaling down instance resources like CPU, memory, and storage, it prevents over-provisioning and minimizes unnecessary costs. Optima is particularly beneficial for variable workloads, ensuring optimal resource usage. By right-sizing instances to match the workload, organizations can achieve better cost-efficiency and maximize the value of their cloud infrastructure.
Automatic Transactions of Reserved Instances
With Optima, managing Reserved Instances becomes a simplified and automated process. Optima automates the entire lifecycle of Reserved Instances, including purchasing, modifying, exchanging, and selling, based on predefined rules. It continuously evaluates resource usage to optimize Reserved Instances allocation, ensuring maximum cost efficiency. By leveraging Optima’s automated approach, organizations can streamline their cloud resource management, enhance cost savings, and easily adapt to changing workloads. It also eliminates the need for manual intervention, providing a more efficient and automated experience for managing Reserved Instances.
Savings Plans Management
With Optima, organizations can effectively manage Savings Plans to achieve significant cost savings in their cloud infrastructure. This involves optimizing usage, monitoring costs, and making data-driven decisions to align Savings Plans with workload demands. Through careful planning, utilization analysis, and ongoing optimization, Optima helps organizations maximize the value of their Savings Plans and optimize their cloud computing costs.
Automatically Shut Down Unused Instances
With Optima’s auto-shutdown feature, you can automate the process of shutting down instances that are not actively utilized, eliminating unnecessary expenses associated with idle instances. Optima’s advanced capabilities include idle instance detection, customizable shutdown policies, and graceful shutdown notifications, ensuring a seamless experience. By automatically managing resource allocation during periods of inactivity, Optima helps you achieve significant cost savings and improve resource utilization.
With Forma Cloud, you gain access to an advanced platform that automates the optimization of your cloud bill. Our solution takes the burden off your shoulders by tracking resources, managing teams, and analyzing hundreds of EC2 instances with their pricing plans. In a matter of minutes, our platform can provide actionable insights on your inventory and usage, identifying opportunities to downgrade instances and maximize cost efficiency. Whether you’re running a small-scale or large-scale cloud environment, Forma Cloud is the trusted companion that streamlines your cost-saving efforts and empowers you with the tools to achieve substantial savings. Experience the difference with Forma Cloud and take control of your cloud costs today.
Forma Cloud has developed some powerful tools that can also help you save on your AWS EC2 costs. Our expert team of AWS engineers and cost management specialists would love to introduce you to ClariSpend and Optima to monitor and report on your spending in an automated fashion. They help you understand your EC2 costs and offer suggestions on how to reduce them. We operate via a fast and efficient ChatOps model so we can provide fast and reliable answers to questions about the cost of your AWS environment. Visit us online to learn more or schedule a demo to see our cost management tools in action.