A `t3.medium` web server becomes slow every afternoon, but CPU never goes above ~20%.
BeginnerTroubleshootingEC2, Auto Scaling and Load Balancing
Answer
Likely causes → The instance is a burstable type in standard credit mode. Once CPUCreditBalance reaches 0, it is throttled to its baseline (20% for t3.medium). CloudWatch then shows CPU flat at the baseline.
Diagnose →
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUCreditBalance \
--dimensions Name=InstanceId,Value=i-0abc --statistics Minimum --period 300 \
--start-time $(date -u -d '-1 day' +%FT%TZ) --end-time $(date -u +%FT%TZ)
aws ec2 describe-instance-credit-specifications --instance-ids i-0abc
Fix →
- Switch to unlimited mode:
aws ec2 modify-instance-credit-specification --instance-credit-specification 'InstanceId=i-0abc,CpuCredits=unlimited'(you pay for surplus credits) - Or move to a fixed-performance type (m7i, c7g) if the load is sustained
Prevent → Alarm on CPUCreditBalance and use T instances only for workloads that really are bursty.