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

After a kernel update and reboot, the instance never comes back: status check fails and SSH times out.

AdvancedTroubleshootingEC2, Auto Scaling and Load Balancing
Answer

Likely causes → The new kernel or initramfs does not boot (missing NVMe or ENA modules), GRUB points at a bad entry, or /etc/fstab references a device that no longer exists.

Diagnose →

aws ec2 get-console-output --instance-id i-0abc --latest --output text | tail -80
# interactive: EC2 Serial Console (needs account-level enablement and a password user)
aws ec2 enable-serial-console-access
aws ec2-instance-connect send-serial-console-ssh-public-key --instance-id i-0abc --serial-port 0 --ssh-public-key file://key.pub

Fix →

  1. Use the Serial Console to pick the previous kernel in GRUB, then fix it
  2. Or use a rescue instance: stop the instance, detach the root volume, attach it to a rescue instance in the same AZ, mount it, fix grub or fstab (nofail, UUIDs), then reattach as /dev/xvda and start
  3. AWSSupport-ExecuteEC2Rescue automation can do this for you

Prevent → Patch through AMI rebuilds and rolling replacement instead of in place, and take snapshots before kernel changes.

aws All AWS questions Roadmap: AWS core services

More on EC2, Auto Scaling and Load Balancing