How to Lower Costs on Long Running AQS EC2 Instances

Reduce cloud costs by applying Reserved Instances to long-running Amazon EC2 instances. Follow the step-by-step instructions to get started.

Patrick Londa
Author
Jul 22, 2022
 • 
 min read
Share this post

With AWS EC2 instances, you have access to scalable virtual machines so that you don't have to commit to purchasing extra hardware for computing processes.

Even though using on-demand AWS EC2 instances can be a fast way to get started, there are a few ways that you and your organization can start to lower your costs. 

In this article, we’ll focus on long running EC2 instances. These are VMs that require a lot of time to run tasks. With AWS EC2's recurring charge, each second that your virtual machine is running makes a difference,  and especially if it involves multiple instances.

By switching the operations of these EC2 instances to Reserved Instances (RIs), you could save up to 72% on your cloud costs compared to on-demand pricing.

This guide will show you ways to cut costs with AWS EC2 by finding long running virtual machines and applying Reserved Instances.

Blink Automation: Detect Long Running AWS EC2 Instances and Send to Slack
AWS + Slack
Try This Automation

Defining Long Running EC2 Instances

Long running AWS EC2 Instances are active for long periods throughout the day and commonly perform tasks like background website scripts or complex computing calculations.

There is no absolute value for what qualifies an instance as “long running”, but your organization can set an arbitrary benchmark to start. You could just focus on instances that have been running for 90 days and use that parameter to guide your audit. These instances may be running consistent, predictable operations, and strong candidates for utilizing RIs. 

How to Handle Long Running Instances

You can locate your long running instances with the AWS Management Console and the EC2 Dashboard. You can click "Instances" in the navigation and then select an EC2 instance to see its launch date and performance data under the "Monitoring" tab. You can also gather additional metrics on instance performance by utilizing a AWS CloudWatch monitoring script.

If an instance has slow performance and is taking up too much time, it may be related to an issue with the processing health of your VM. If your instance is long running due to failure, you can troubleshoot it to figure out what the root of its issues is.

If the long running jobs are not business-critical, then you might be able to reduce your costs just by canceling the jobs that the instance is tasked with running. With the AWS Management Console, you can directly stop, cancel, or terminate long running jobs.

Once you have identified your long running instances and determined if there are any health or job-related issues, you may find that you have healthy instances running naturally time-intensive tasks. If you expect these long running jobs will need to continue to be run as is, then you can consider changing to use Reserved Instances.

Reserved Instances for Cost Savings

AWS Reserved Instances can save you money by discounting your EC2 instances by at least 70%. This discount can be applied to your AWS EC2 instances without having to rebuild your VMs from scratch and is a discount for a one to three-year commitment. To purchase this discount:

  1. View the EC2 Dashboard.
  2. On the left, click on "Reserved Instances."
  3. Click on "Purchase Reserved Instance" to reveal multiple reserved instance options.
  4. Select the reserved instance that is appropriate for you.
  5. Add the appropriate RI to your cart and complete your check out.

AWS EC2 RIs apply automatically to new or existing instances that match the RI type. RI type is based on the kind of RI you choose to purchase. The selected RIs can only be applied to instances of the same type. Your VMs need to match the RIs requirements to qualify for the pricing discount. It is possible for you to scope your RIs based on region or area. If done this way, your RIs will automatically be applied to instances across instance sizes in the region or area. Standard and Convertible AWS EC2 RIs provide different discounts on your instances, so choose wisely to ensure you get the best deal for your case.

Automatically Finding Long Running Instances with Blink 

You can make better decisions when you have more data readily accessible. Before you can make decisions about how to handle a long running instance, you need information about which instances qualify, what their usage data looks like, and the related business-impacts.

Instead of manually searching through your AWS console or scripting a query, there’s an easier way to aggregate reports on long running instances regularly.

With Blink, you can run this automation to run regularly and produce reports on all the instances that fit the criteria.

Blink Automation: Detect Long Running AWS EC2 Instances and Send Report to Slack
Blink Automation: Detect Long Running AWS EC2 Instances and Send Report to Slack

When this automation runs, it executes the following actions:

  1. Gets all AWS EC2 instances.
  2. Finds the instances that are running longer than the specified number of days.
  3. Sends a list of long running instances to Slack.

You can import this automation from the Blink library and customize it however you like. For example, you could add conditional logic to take actions on long running instances pending someone’s approval in Slack.

In Blink, you can also create automations from scratch to meet your team’s unique needs using the hundreds of drag-and-drop actions available from a wide range of tools.

Get started with Blink today to see how easy automation can be.

Expert Tip