π Connecting to EC2 Instances
To manage an EC2 instance, you need a way to securely access it. AWS gives you a few options depending on your OS β think of it like remote-desktopping into a computer, just different tools for the job.
<div class="infographic-ssh2">
<style>
.infographic-ssh2 {
--ink: #1a1a1a;
--ink-soft: #5c5c5c;
--paper: #ffffff;
--paper-alt: #f0ece4;
--accent: #2563eb;
--accent-soft:#e3ebfd;
--line: #ddd6c9;
--good: #1c7a3c;
--good-soft: #e4f4e9;
--body-font: 'Inter', -apple-system, sans-serif;
background: var(--paper);
color: var(--ink);
font-family: var(--body-font);
max-width: 720px;
margin: 0 auto;
padding: clamp(1.25rem, 5vw, 2.5rem);
box-sizing: border-box;
}
.infographic-ssh2[data-theme="dark"] {
--ink: #e8e6e1;
--ink-soft: #9a968c;
--paper: #121212;
--paper-alt: #1e1e26;
--accent: #5b8def;
--accent-soft:#202942;
--line: #2c313d;
--good: #4fbf74;
--good-soft: #16281c;
}
.infographic-ssh2 * { box-sizing: border-box; }
.ssh2-grid {
display: grid;
grid-template-columns: 64px repeat(3, 1fr);
gap: 2px;
background: var(--line);
border: 1px solid var(--line);
}
.ssh2-cell {
background: var(--paper);
display: flex; align-items: center; justify-content: center;
min-height: 68px;
transition: background 0.15s, transform 0.15s;
}
.ssh2-cell.head {
min-height: 76px;
background: var(--paper-alt);
cursor: pointer;
border-bottom: 2px solid transparent;
flex-direction: column;
gap: 0.2rem;
}
.ssh2-cell.head .ico { font-size: 1.5rem; }
.ssh2-cell.head .lbl { font-size: 0.68rem; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.15; }
.ssh2-cell.head:hover { border-bottom-color: var(--accent); }
.ssh2-cell.head.corner { background: var(--paper-alt); font-size: 1rem; }
.ssh2-cell.rowicon {
background: var(--paper-alt);
cursor: pointer;
border-right: 2px solid transparent;
flex-direction: column;
gap: 0.15rem;
}
.ssh2-cell.rowicon .ico { font-size: 1.3rem; }
.ssh2-cell.rowicon .lbl { font-size: 0.62rem; font-weight: 600; color: var(--ink-soft); text-align: center; line-height: 1.1; }
.ssh2-cell.rowicon:hover { border-right-color: var(--accent); }
.ssh2-cell .mark { font-size: 1.4rem; color: var(--line); }
.ssh2-cell .mark.yes { color: var(--good); }
.ssh2-cell .mark.no { font-size: 1.1rem; color: var(--line); }
.ssh2-row.is-active .ssh2-cell { background: var(--accent-soft); }
.ssh2-row.is-active .ssh2-cell.rowicon { background: var(--accent); }
.ssh2-row.is-active .ssh2-cell.rowicon .lbl { color: #ffffff; }
.ssh2-row.is-active .ssh2-cell .mark.yes { transform: scale(1.15); }
.ssh2-col-active { background: var(--accent-soft); }
.ssh2-col-active.head { background: var(--accent); }
.ssh2-col-active.head .lbl { color: #ffffff; }
@media (max-width: 480px) {
.ssh2-grid { grid-template-columns: 56px repeat(3, 1fr); }
.ssh2-cell { min-height: 56px; }
.ssh2-cell.head { min-height: 66px; }
.ssh2-cell.head .ico { font-size: 1.25rem; }
.ssh2-cell.head .lbl { font-size: 0.58rem; }
.ssh2-cell.rowicon .ico { font-size: 1.1rem; }
.ssh2-cell.rowicon .lbl { font-size: 0.52rem; }
.ssh2-cell .mark { font-size: 1.15rem; }
}
</style>
<div class="ssh2-grid" role="table" aria-label="EC2 connection method compatibility">
<div class="ssh2-cell head corner">π</div>
<div class="ssh2-cell head" data-col="ssh" tabindex="0" role="button" aria-label="SSH"><span class="ico">β¨οΈ</span><span class="lbl">SSH</span></div>
<div class="ssh2-cell head" data-col="putty" tabindex="0" role="button" aria-label="PuTTY"><span class="ico">π</span><span class="lbl">PuTTY</span></div>
<div class="ssh2-cell head" data-col="eic" tabindex="0" role="button" aria-label="EC2 Instance Connect"><span class="ico">π</span><span class="lbl">Instance Connect</span></div>
<div class="ssh2-row" data-os="mac">
<div class="ssh2-cell rowicon" data-row="mac" tabindex="0" role="button" aria-label="Mac"><span class="ico">π»</span><span class="lbl">Mac</span></div>
<div class="ssh2-cell" data-col="ssh"><span class="mark yes">β</span></div>
<div class="ssh2-cell" data-col="putty"><span class="mark no">β</span></div>
<div class="ssh2-cell" data-col="eic"><span class="mark yes">β</span></div>
</div>
<div class="ssh2-row" data-os="linux">
<div class="ssh2-cell rowicon" data-row="linux" tabindex="0" role="button" aria-label="Linux"><span class="ico">π§</span><span class="lbl">Linux</span></div>
<div class="ssh2-cell" data-col="ssh"><span class="mark yes">β</span></div>
<div class="ssh2-cell" data-col="putty"><span class="mark no">β</span></div>
<div class="ssh2-cell" data-col="eic"><span class="mark yes">β</span></div>
</div>
<div class="ssh2-row" data-os="win-old">
<div class="ssh2-cell rowicon" data-row="win-old" tabindex="0" role="button" aria-label="Windows older than 10"><span class="ico">πͺ</span><span class="lbl">Win <10</span></div>
<div class="ssh2-cell" data-col="ssh"><span class="mark no">β</span></div>
<div class="ssh2-cell" data-col="putty"><span class="mark yes">β</span></div>
<div class="ssh2-cell" data-col="eic"><span class="mark yes">β</span></div>
</div>
<div class="ssh2-row" data-os="win-new">
<div class="ssh2-cell rowicon" data-row="win-new" tabindex="0" role="button" aria-label="Windows 10 and newer"><span class="ico">πͺ</span><span class="lbl">Win 10+</span></div>
<div class="ssh2-cell" data-col="ssh"><span class="mark yes">β</span></div>
<div class="ssh2-cell" data-col="putty"><span class="mark yes">β</span></div>
<div class="ssh2-cell" data-col="eic"><span class="mark yes">β</span></div>
</div>
</div>
<script>
(function () {
const wrapper = document.currentScript.closest('.infographic-ssh2')
|| document.querySelector('.infographic-ssh2');
const bodyAttr = document.body.getAttribute('data-darkmode');
let dark;
if (bodyAttr === 'true') {
dark = true;
} else if (bodyAttr === 'false') {
dark = false;
} else {
const match = document.cookie.match(/(?:^|;\s*)darkMode=([^;]+)/);
dark = match ? match[1] === 'true' : false;
}
if (dark) wrapper.setAttribute('data-theme', 'dark');
const rowIcons = wrapper.querySelectorAll('.ssh2-cell.rowicon');
const colHeads = wrapper.querySelectorAll('.ssh2-cell.head[data-col]');
const rows = wrapper.querySelectorAll('.ssh2-row');
function clearAll() {
rows.forEach(r => r.classList.remove('is-active'));
wrapper.querySelectorAll('.ssh2-col-active').forEach(el => el.classList.remove('ssh2-col-active'));
}
rowIcons.forEach(icon => {
icon.addEventListener('click', () => {
const row = icon.closest('.ssh2-row');
const wasActive = row.classList.contains('is-active');
clearAll();
if (!wasActive) row.classList.add('is-active');
});
icon.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); icon.click(); } });
});
colHeads.forEach(head => {
head.addEventListener('click', () => {
const col = head.dataset.col;
const wasActive = head.classList.contains('ssh2-col-active');
clearAll();
if (!wasActive) {
wrapper.querySelectorAll('[data-col="' + col + '"]').forEach(el => el.classList.add('ssh2-col-active'));
}
});
head.addEventListener('keydown', e => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); head.click(); } });
});
})();
</script>
</div>.demo {
font-family: system-ui, sans-serif;
padding: 16px;
}
.demo h1 {
color: #2563eb;
margin: 0 0 8px;
}
.demo p {
color: #4b5563;
margin: 0;
}document.querySelector('.demo h1')?.addEventListener('click', () => {
alert('Hello from live preview!');
});1οΈβ£ SSH β the standard method
Built into Mac & Linux terminals natively
Also built into Windows 10+
Uses key pairs (.pem) for authentication
Command-line based, so it requires some comfort with CLI
2οΈβ£ PuTTY β for older Windows
Needed on Windows versions before 10 (no native SSH client)
Does the same job as SSH, just a separate installed tool
Uses .ppk key format instead of .pem
3οΈβ£ EC2 Instance Connect β browser-based
No installation, works straight from the AWS Console
Works on any OS (Mac, Linux, all Windows versions)
Best for beginners β simplest option
β οΈ Limitation: currently only supports Amazon Linux 2
4οΈβ£ Which one should you use?
Your OS | Recommended method |
|---|---|
Mac / Linux | SSH |
Windows 10+ | SSH or EC2 Instance Connect |
Windows < 10 | PuTTY or EC2 Instance Connect |
This course primarily uses EC2 Instance Connect for simplicity.
5οΈβ£ Common SSH problems
If a connection fails, check these first:
Port 22 blocked in the security group
Wrong key / bad file permissions
Typos in the SSH command
Wrong username (e.g. should be
ec2-user)
If stuck, fall back to EC2 Instance Connect.
6οΈβ£ Key takeaways
β There are multiple ways to connect β pick based on your OS
β SSH is the standard, but trickiest for beginners
β PuTTY = SSH equivalent for old Windows
β EC2 Instance Connect = easiest, browser-based, no setup
β You only need one working method, not all three
π‘ Exam tip
Keyword in question | Think |
|---|---|
"browser-based access" | EC2 Instance Connect |
"secure CLI access to Linux" | SSH |
"Windows + SSH alternative" | PuTTY |