Q: You launched an EC2 instance but can't SSH into it. What do you check?
1. Security Group — does inbound rule allow port 22 from your IP? Check in the EC2 console under Security Groups.
Want to master this scenario in a live sandbox? Stephane Maarek's AWS Certified DevOps Engineer Professional Masterclass on Udemy covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "In our AWS cloud environment, we managed high-traffic microservices where this exact scenario occurred. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix."
Initial Diagnostics & Root Cause Analysis
- Security Group — does inbound rule allow port 22 from your IP? Check in the EC2 console under Security Groups.
- Key pair — are you using the correct
.pemfile? Is it the right one for that instance? - File permissions —
chmod 400 key.pem. SSH won't work if key permissions are too open. - Instance state — is it running? Not stopped or pending?
Remediation & Permanent Safeguards
Execute the resolution runbook and verify workload health:
- Public IP — does it have a public IP or Elastic IP assigned?
- VPC/Subnet — is it in a public subnet with an Internet Gateway? A private subnet instance can't be SSH'd from internet.
- NACL — Network ACLs can block traffic even if Security Groups allow it. NACLs are stateless.
- Security Group — does inbound rule allow port 22 from your IP? Check in the EC2 console under Sec...
- Key pair — are you using the correct .pem file? Is it the right one for that instance?
- File permissions — chmod 400 key.pem. SSH won't work if key permissions are too open.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Granting wildcard statements ('Action: *', 'Resource: *') in production IAM role trust and policy documents when addressing instance Wildcard IAM grants violate least-privilege principles, allowing unauthorized lateral movement and privilege escalation across accounts.
- Provisioning long-lived IAM access keys instead of federated IAM roles assumed via temporary STS credentials Static long-lived access keys are the primary cause of cloud credential leakage; modern architectures leverage IAM Roles with temporary STS tokens.
- Neglecting VPC NAT Gateway data processing fees and zonal placement when designing outbound egress architectures Routing cross-AZ egress through a single NAT Gateway incurs cross-AZ data transfer fees and introduces a single point of network failure.
- Overlooking AWS CloudTrail management event lag when auditing real-time infrastructure API modifications CloudTrail event delivery typically has a 5-15 minute delivery window; real-time alerting requires EventBridge event bus subscriptions.