AWS Fundamentals Series

🔑 Understanding EC2 Key Pairs (.pem/.ppk) and Reserved Subnet IPs from a "Top 1%" Perspective

Introduction

This article is part of the Top 1% Series’ full article guide, and the first article in a new series on AWS fundamentals.

Prerequisites

Getting the Big Picture

The Role of an EC2 Key Pair

The key pair you specify when launching an EC2 instance is authentication credential, based on public-key cryptography, for logging into that instance securely without a password. AWS configures the public key on the instance, and you connect using the corresponding private key file. The difference between the .pem and .ppk extensions is a difference in the “format” of this private key file.

graph LR
    KeyPair["Key pair (generated on AWS's side)"]
    KeyPair --> Public["Public key (automatically configured on the instance)"]
    KeyPair --> Private["Private key file<br/>(downloaded in .pem or .ppk format)"]
    Private -->|"Connect using this private key"| Instance["EC2 instance"]

Fundamentals, Explained Thoroughly

The Difference Between .pem and .ppk: A Format Difference, Not a Cryptographic One

.pem and .ppk represent the same private key information, just in different file formats.

FormatMain software using itCharacteristics
.pemOpenSSH (standard on Linux/macOS, and the OpenSSH client built into Windows 10 and later)A Base64-encoded text format. The standard format for many SSH clients.
.ppkPuTTY (a traditionally popular SSH/Telnet client on Windows)PuTTY’s own proprietary binary format.

The format AWS lets you download when creating an EC2 key pair is .pem by default. A tool like PuTTY can’t directly read any format other than its own proprietary one (.ppk), so if you want to connect using PuTTY, you need to convert the .pem file downloaded from AWS to .ppk format using PuTTY’s bundled conversion tool, PuTTYgen.

Which to choose is, in practice, decided simply by “which SSH client software you’re using.” Current Windows 10/11 comes with an OpenSSH client built in by default, letting you connect via SSH directly with the .pem-format file from Command Prompt or PowerShell. If you’re used to PuTTY, or your existing operations continue to use PuTTY, you’ll need to convert to .ppk.

No difference in cryptographic strength or security

.pem and .ppk are simply a difference in the file format (container) storing the same private key information — there’s no difference in the encryption algorithm the key itself uses (RSA, Ed25519, and so on), or in the key’s security itself. Converting with PuTTYgen is simply re-encoding the same key information into a different format.

Why PuTTY used to be the default, and OpenSSH is now standard

For a long time, Windows had no SSH client built in the way Linux and macOS did. PuTTY, which appeared in the late 1990s, filled that gap and became the de facto standard for Windows users, largely because it was free, lightweight, and had a GUI. That changed relatively recently: starting with Windows 10 (the 2018 Fall Creators Update) and Windows Server 2019, an OpenSSH client became available as a built-in optional feature. That means you no longer need to install separate software — you can run ssh directly from Command Prompt or PowerShell. If you’re choosing a new SSH setup today, OpenSSH is the more sensible choice: no extra installation, and the same command set you already know from Linux and macOS. PuTTY still gets chosen for existing workflows that already depend on it, or when someone prefers its GUI-based fine-grained connection settings (character encoding, key bindings, and so on).

AWS Subnet Reserved IP Addresses

When you create a subnet within a VPC, AWS reserves a total of five IP addresses out of that subnet’s CIDR range — the first four and the last one — making them unavailable for assignment to EC2 instances or anything else.

For example, if you create a subnet with 10.0.0.0/24, these are reserved as follows:

IP addressPurpose
10.0.0.0The network address (conventionally reserved as representing the subnet itself)
10.0.0.1Reserved for the VPC router
10.0.0.2Reserved for Amazon’s DNS server (used for name resolution within the VPC)
10.0.0.3Reserved by AWS for future use
10.0.0.255 (last)The network broadcast address (AWS doesn’t support broadcast, but it’s conventionally reserved anyway)

The first three (router, DNS, future reservation) are addresses the VPC service itself needs internally to manage and provide its functionality. In particular, 10.0.0.2 functions as the address of the Amazon-provided DNS server (Route 53 Resolver) that instances within the VPC query for name resolution. The first address, 10.0.0.0, and the last, 10.0.0.255, serve no actual function on AWS, but are still treated as reserved IPs, in line with traditional IP networking convention (a network address and broadcast address).

Is "the VPC router" one per VPC, or one per subnet?

The reserved X.X.X.1 exists once per subnet. There isn’t a single physical or virtual router device shared by every subnet across the whole VPC. Unlike on-premises networking hardware, AWS’s VPC routing is a fully virtualized, distributed mechanism: the AWS infrastructure itself transparently handles routing (without exposing any actual router device) based on the route table configuration attached to each individual subnet. It’s more accurate to think of it as “each subnet gets its own X.X.X.1 as that subnet’s dedicated gateway address.” The fact that you can configure and inspect each subnet’s route table independently reflects exactly this design: routing is handled independently, per subnet.

graph LR
    subgraph Subnet["10.0.0.0/24 subnet"]
        A["10.0.0.0<br/>Network address"]
        B["10.0.0.1<br/>VPC router"]
        C["10.0.0.2<br/>Amazon DNS server"]
        D["10.0.0.3<br/>Reserved for future use"]
        E["10.0.0.4–10.0.0.254<br/>Actually assignable"]
        F["10.0.0.255<br/>Broadcast address"]
    end

Because of these five reserved IP addresses, when designing a subnet’s CIDR, you need to think in terms of the actual assignable count — subtracting these five — rather than simply mapping the CIDR range’s host count to your expected instance count. For example, a /28 subnet (16 IP addresses) actually only has 16 - 5 = 11 addresses assignable to instances.

The View From the Top 1% Perspective

A Practical Caveat in Subnet Size Design

A design creating many overly small subnets (such as /28) sees the impact of these five reserved IP addresses become proportionally larger, potentially leading to running out of IP addresses sooner than expected. It’s practically important to design subnet sizes with room to spare, factoring in future scaling, from the design stage onward.

Common Misconceptions and Pitfalls

The Troubleshooting Perspective

For EC2/VPC networking issues, the basic approach is to isolate whether the problem is with the key pair format, or with subnet design/reserved IPs.

  1. PuTTY won’t recognize the key file when trying to connect: This is likely because the .pem file downloaded from AWS hasn’t been converted to .ppk format with PuTTYgen.
  2. An instance in a subnet can’t be assigned the expected IP address: Check whether that IP address falls within the reserved first-four or last-one addresses.
  3. A small subnet ran out of IP addresses sooner than expected: Recalculate the actual assignable count, factoring in the impact of the five reserved IP addresses, and consider revisiting the subnet size.

Preventive Measures and Permanent Fixes

Summary

What to Keep in Mind From Today

  1. When deciding on a key pair format, judge based on compatibility with the SSH client software you’re using, not a difference in cryptographic strength.
  2. When designing a subnet’s size, always calculate using the actual assignable count after subtracting the five reserved IP addresses.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).