How to quickly stress test CPU on Amazon Linux

Greg
Oct 14, 2022

Download and install the stress test tool

sudo amazon-linux-extras install epel -y
sudo yum install stress -y

Launch the stress test in background (for 800 seconds in that example)

sudo stress --cpu 8 --timeout 800 &

Check the stress test processes with the top command

top

Result for the top command

Manually stop the stress test (if needed)

sudo killall stress

Check the EC2 CPU metric in Clouwatch
(protip, enable detailed monitoring)

Cloudwatch metrics for the CPU

Why does my CPU stress test stop after a few minutes ?

→ Probably because your a using a “t” based instance (such as t2, t3).
https://stackoverflow.com/questions/61920470/aws-cloudwatch-cpu-utilization-doesnt-match-actual-usage

Thank you

--

--