Skip to main content

Optimize AWS EC2 costs with recommendations

An effective way to reduce AWS EC2 instance costs is to optimize VM utilization. This involves resizing instances based on active tasks and decommissioning unused instances.

Harness helps you reduce costs with recommendations.

You can view the recommendations for all of your AWS accounts on the recommendations page.

You can also tune these recommendations by instance family or across instance families (General Purpose, Compute Optimized, etc.).


Before using recommendations in your environment, ensure that you evaluate their impact thoroughly. The person reviewing the recommendations should be able to understand the impacts identified in the recommendations, as well as the impact on the infrastructure and business.

Using recommendations without proper assessment could result in unexpected changes, such as issues with system performance or poor reliability.

Before you begin

  • Connect your AWS cloud account in Harness and set up CCM for cost management. For more information, go to Set up cost visibility for AWS.
  • To obtain EC2 recommendations, configure a Harness AWS CCM connector with the Inventory Management feature enabled.
  • Go to Perspectives to learn how to create perspectives. Perspectives allow you to group your resources in ways that are more meaningful to your business needs.

How are EC2 recommendations computed?

The recommendations are computed by analyzing the past utilization of the CPU and memory of your EC2 instance. Harness CCM leverages the AWS EC2 recommendations. CCM uses the AWS APIs and fetches the data from the AWS account.

Types of EC2 recommendations

Harness CCM provides two types of recommendations to optimize your EC2 instances:

  • Instance resizing: In this type of recommendation, CCM recommends resizing your instance within the same instance family or using a different instance family based on instance usage. For information about the different instance families in AWS, go to Available instance types.

  • Decommissioning: In this type of recommendation, the instance is terminated or decommissioned if not in use for a long time.

Enable EC2 recommendations

You must add the required permissions and enable EC2 recommendations in AWS. Go to Enable EC2 recommendations for the tasks to be performed on your AWS console.

After completing the aforementioned tasks, you need to perform the following steps in Harness:

  1. While creating a new AWS CCM connector, select the Inventory Management feature to enable recommendations. For more information, go to Set up CCM for your AWS account.

  2. Add the required Cost Explorer permissions to the CCM template:

View your EC2 recommendations

  1. In Harness, go to the Cloud Costs module.
  2. Click Recommendations.
  3. Click the filter icon.
  4. In the Recommendation Type dropdown list, select EC2_INSTANCE.
  5. Click Apply.

All the AWS accounts with EC2 instances are displayed.

  1. Click the row to view the recommendations for that account. The CPU and Memory utilization graph shows the current utilization data. Go to View and apply recommendations to learn how to apply these recommendations.

CPU and Memory Metrics

To enable CPU metrics, CloudWatch has to be enabled for the AWS account.

To enable Memory metrics cloud watch agent has to be installed on every EC2 instance. You can use the external metrics ingestion feature in AWS to configure the AWS Compute Optimizer to ingest EC2 memory utilization metrics from Datadog, among other observability products like Datadog, Dynatrace, Instana, and New Relic 1. In this case, EC2 recommendation will be generated by taking account of Memory metrics as well along with CPU metrics.


Ingesting Memory Metrics with Datadog Integration

If we ingest Memory metrics using Datadog integration, generation of EC2 Recommendations do consider Datadog metrics; however, the memory utilization data is not displayed on the EC2 Recommendation page.

The CPU and Memory metrics data we retrieve is sourced from CloudWatch, and in this specific case, the metrics originate from an external source, Datadog.

These Datadog metrics are directly integrated with AWS Compute Optimizer and are utilized in generating the recommendations.

As per the AWS Compute Optimizer API documentation, they do not offer support for retrieving these utilization metrics. Consequently, Memory metrics will not be shown in the recommendations.

Tune the EC2 recommendations

You can tune the recommendations by providing your preferred instance type. Select one of the following options:

  • Within the same instance family: If you select this option, the recommendations stay within the same family.
  • Across instance families: If you select this option, CCM recommends instance types across instance families. The priority is to provide maximum cost savings.

Sharing recommendations​

When you tune a recommendation, the URL for the recommendation captures your changes.

You can see the changes following details? in the URL. For example, details?buffer=10&QoS="GUARANTEED".

Capturing your changes in the URL enables you to share your tuned recommendation and ensure others can see your tuning. Simply tune the recommendation and then share the URL.