teluzia.Cloud Engineer · Day 148
CHAPTER 22 · TROUBLESHOOTING AND BEHAVIOURAL INTERVIEWS

EC2 connectivity and Linux diagnosis

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

EC2 connectivity path is today's starting point. Connection refused usually means an address was reached but no usable listener accepted the connection; timeout leaves routing, filtering and host reachability open. Permission denied points later toward SSH authorization. You will connect this with linux host diagnosis and credentials and recovery. The lesson's artifact brings these decisions together: Analyze synthetic timeout, refusal and permission-denied transcripts; draw the responsible layer and propose one least-permissive next check for each.

Think of it this way

Connectivity diagnosis follows a parcel route from address lookup to roads, gates and the receiving desk; each failure location produces a different clue.

TOPIC 01 / 03Step by step

EC2 connectivity path

Follow client, DNS, public/private routing, security group, network ACL and host listener in order. A timeout differs from connection refused; preserve the actual symptom before changing controls. Connection refused usually means an address was reached but no usable listener accepted the connection; timeout leaves routing, filtering and host reachability open. Permission denied points later toward SSH authorization.

WORKED EXAMPLE
Connection refused usually means an address was reached but no usable listener accepted the connection; timeout leaves routing, filtering and host reachability open. Permission denied points later toward SSH authorization.

A route selects a network path; a security group controls permitted traffic at the relevant interface; a listener is a process accepting connections on a port. Imagine an SSH connection works from one subnet but times out from another. Compare source path and controls before changing the host configuration. Check the instance address and whether the intended route exists, then evaluate interface and subnet filtering and the host listener. Network ACLs and security groups have different semantics, so do not assume changing one automatically fixes the other. Read the exact client symptom and preserve timestamps. Broad inbound access may make a test succeed but creates unnecessary exposure and conceals the failed boundary. Identify the smallest supported correction and verify from the originally failing source, not only from an administrator's laptop.

Why this matters

Permission denied points later toward SSH authorization.

A common trap

A timeout and permission-denied response prove the same failure layer.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

EC2 connectivity path

Follow client, DNS, public/private routing, security group, network ACL and host listener in order. A timeout differs from connection refused; preserve the actual symptom before changing controls. Connection refused usually means an address was reached but no usable listener accepted the connection; timeout leaves routing, filtering and host reachability open. Permission denied points later toward SSH authorization.

WORKED EXAMPLE
Connection refused usually means an address was reached but no usable listener accepted the connection; timeout leaves routing, filtering and host reachability open. Permission denied points later toward SSH authorization.

A route selects a network path; a security group controls permitted traffic at the relevant interface; a listener is a process accepting connections on a port. Imagine an SSH connection works from one subnet but times out from another. Compare source path and controls before changing the host configuration. Check the instance address and whether the intended route exists, then evaluate interface and subnet filtering and the host listener. Network ACLs and security groups have different semantics, so do not assume changing one automatically fixes the other. Read the exact client symptom and preserve timestamps. Broad inbound access may make a test succeed but creates unnecessary exposure and conceals the failed boundary. Identify the smallest supported correction and verify from the originally failing source, not only from an administrator's laptop.

Why this matters

Permission denied points later toward SSH authorization.

A common trap

A timeout and permission-denied response prove the same failure layer.

Linux host diagnosis

Check processes, listening sockets, disk space, memory and logs. Read-only commands such as ss -ltn, df -h and journalctl narrow hypotheses without opening network access. ss -ltn shows port 22 listening, df -h shows a full root filesystem, and journal logs reveal failed writes. Opening another inbound rule would not repair the full disk.

WORKED EXAMPLE
ss -ltn shows port 22 listening, df -h shows a full root filesystem, and journal logs reveal failed writes. Opening another inbound rule would not repair the full disk.

A process is a running program; a socket is its communication endpoint; resource pressure occurs when required capacity becomes scarce. Imagine an instance responds to SSH but the application times out. Inspect the application's service status, port and recent logs, then check disk, memory and CPU without restarting first. A full filesystem can prevent logging or socket-related startup even when networking is correctly configured. Compare current utilization with normal baselines and recent changes, because a snapshot does not establish a historical cause. Read-only diagnosis preserves useful evidence, while invasive repair can erase it. Select a reversible mitigation for the actual constraint and verify the application request afterward. Access to a shell proves host reachability but does not prove the service's process, permissions or dependency path is healthy.

Why this matters

Opening another inbound rule would not repair the full disk.

A common trap

Opening a network rule proves a process is listening correctly.

Credentials and recovery

Distinguish network reachability from SSH identity authorization. Verify user, key and instance access method; prefer an established recovery channel instead of broad inbound rules. Use the expected Linux user and its authorized key. A correct key for the wrong user can fail; verify identity mapping before considering a controlled recovery channel.

WORKED EXAMPLE
Use the expected Linux user and its authorized key. A correct key for the wrong user can fail; verify identity mapping before considering a controlled recovery channel.

Authentication establishes the presented identity; authorization determines allowed access; recovery access is a separately prepared route for repairing failed primary access. Imagine the network handshake succeeds but the expected account rejects the key. Verify the account name, key pairing and authorized-key configuration before opening additional ports. A wrong user can produce the same apparent symptom as a wrong key. Consider instance lifecycle changes that could have replaced credentials or altered the image. Use only an authorized established recovery method, and document what evidence it reveals without exposing private keys. More fallback mechanisms can improve recoverability but also add sensitive access paths that require control. After repair, verify normal access with the intended least-privileged identity and close any temporary recovery permissions through the agreed process.

Why this matters

A correct key for the wrong user can fail; verify identity mapping before considering a controlled recovery channel.

A common trap

Successful network reachability proves SSH key authorization.

KEEP THESE WITH YOU

Today’s takeaways

EC2 connectivity path: Follow client, DNS, public/private routing, security group, network ACL and host listener in order.

Linux host diagnosis: Check processes, listening sockets, disk space, memory and logs.

Credentials and recovery: Distinguish network reachability from SSH identity authorization.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed