Interview Prep/AWS/VPC and Connectivity

`ssh: connect to host ... port 22: Connection refused`. How is it different from a timeout?

BeginnerTroubleshootingVPC and Connectivity
Answer

Likely causes → Refused means the packet arrived but nothing is listening, or the OS firewall rejected.

Diagnose →

aws ec2 get-console-output --instance-id i-0abc --latest --output text | tail -50
aws ssm start-session --target i-0abc
sudo ss -ltnp | grep 22
sudo systemctl status sshd

Fix →

  1. Start sshd
  2. Fix sshd_config
  3. Check ufw or iptables

Prevent → Bake sshd settings into the AMI.

aws All AWS questions Roadmap: AWS core services

More on VPC and Connectivity