Interview Prep/AWS/EC2, Auto Scaling and Load Balancing

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 →

  1. Switch to unlimited mode: aws ec2 modify-instance-credit-specification --instance-credit-specification 'InstanceId=i-0abc,CpuCredits=unlimited' (you pay for surplus credits)
  2. 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.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing