Fix AWS EC2 High CPU Usage — Identify & Resolve

Direct answer

EC2 high CPU usage is caused by a process consuming excessive compute cycles — typically a runaway application thread, undersized instance, or malicious process. SSH in and run top to identify the process, then check CloudWatch for the duration pattern.

Structured breakdown

Cause

High EC2 CPU is typically caused by runaway processes, insufficient instance sizing, or application-level infinite loops. SSH in, run top to find the culprit process, then address the root cause.

Fix

  • SSH into the instance and run top or htop to identify the high-CPU process
  • Check CloudWatch CPU metrics to determine if this is a spike or sustained pattern
  • Right-size the instance type based on actual CPU utilization requirements

Outcome

CPU utilization drops to normal levels after addressing the offending process or resizing the instance.

Common causes

  • Runaway application process or infinite loop
  • Instance type undersized for workload
  • Crypto mining malware or compromised instance
  • Inefficient code running CPU-bound tasks without throttling
  • Missing auto-scaling causing single instance to absorb all traffic

Fix steps

  1. 1

    SSH into the instance and run top or htop to identify the high-CPU process

  2. 2

    Check CloudWatch CPU metrics to determine if this is a spike or sustained pattern

  3. 3

    Right-size the instance type based on actual CPU utilization requirements

  4. 4

    Implement auto-scaling groups to distribute load across multiple instances

  5. 5

    Audit the process — if unknown, run security scans for compromised binaries

Analyze this issue

Paste the issue description, logs, or symptoms into the fix tool to inspect this problem with your own runtime details.

kintify fix

Need more context?

If the standard steps do not resolve the issue, open the fix tool and include the current logs, configuration, and deployment changes.

Open Fix Tool

Frequently asked questions

These examples show the commands, logs, and configuration patterns most often used to verify this issue.

Command examples

  • top -b -n 1 | head -20
  • aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --period 300 --statistics Average --dimensions Name=InstanceId,Value=i-xxxx

Log snippet

PID   USER   %CPU  %MEM  COMMAND
3421  app    98.2  45.1  node server.js
  12  root    0.3   0.1  [ksoftirqd/0]

Config snippet

Resources:
  Type: AWS::AutoScaling::ScalingPolicy
  Properties:
    AdjustmentType: ChangeInCapacity
    ScalingAdjustment: 1
    Cooldown: 300