Launch an EC2 Instance

Beginner
10 min read
Updated: Nov 2026
5 examples
EC2 / Ubuntu / Security groups

Definition and Usage

Amazon Elastic Compute Cloud (EC2) provides virtual servers in the cloud. Launching an instance is the first step before you install runtimes, deploy apps, or attach load balancers.

What is launching an EC2 instance?

You pick an AMI (OS image), an instance type (CPU/RAM profile), a key pair for SSH, and a security group for inbound ports. AWS then provisions a virtual machine in your Region’s default VPC unless you choose otherwise.

When should you use this guide?

Use it for a first Ubuntu lab on AWS. After the instance is running, add an Elastic IP, connect with PuTTY or OpenSSH, then deploy something such as Node.js on EC2.

What you will build

A running Ubuntu Server instance with a downloaded private key and security group rules for SSH (and optional HTTP/HTTPS).

Console labels change

The launch wizard wording can shift over time. Treat the screenshots as a visual anchor and match the same ideas: AMI, type, key pair, network rules, then Launch.

Billing starts when the instance runs.

Stop or terminate labs you do not need. You still pay for EBS storage while stopped, and unused Elastic IPs can bill too.

Guard the private key.

AWS shows the .pem / .ppk file once. Anyone with that file and open SSH can log in as the default user.

Next after launch.

Attach a stable public IPv4 with Elastic IP, then harden SSH and deploy your app.

Core Concepts

Terms you will use while launching:

ConceptMeaning
AMIAmazon Machine Image — OS and root volume template
Instance typeVirtual hardware size (vCPU, memory, network)
Key pairPublic key on the instance; private key on your laptop for SSH
.pem / .ppkPrivate key formats for OpenSSH vs PuTTY
Security groupStateful firewall for inbound and outbound rules
VPC / subnetNetwork placement for the instance (often default VPC for labs)
EBSBlock storage attached as the root (and extra) volumes
Public IPv4Address used to reach the instance from the internet (can change on stop/start unless you use Elastic IP)

Prerequisites

Have these ready before you launch:

  • An AWS account with rights to create EC2 instances and key pairs. You can sign up for AWS if needed.
  • Access to the AWS Management Console in the Region where you want the instance.
  • An SSH client ready for later—PuTTY (.ppk) or OpenSSH (.pem).

Examples

Open the launch wizard, pick Ubuntu and a small instance type, create a key pair, open ports, then confirm Running.

Example 1 — Open the Launch Wizard

Sign in to the console, open EC2, and start a new instance.

  1. In the search bar at the top, type EC2 and open the EC2 service.
  2. On the EC2 dashboard, open Instances in the left navigation, then choose Launch instance.
AWS console search showing EC2 service
AWS Management Console
EC2 Instances page with Launch instance button
Amazon EC2

How It Works

  1. EC2 is Region-scoped—confirm the Region in the top-right corner before you launch.
  2. Instances lists existing VMs; Launch instance opens the wizard.
  3. Default VPC is fine for a first lab; custom networks are covered in a VPC and subnets guide.
  4. Name tags later help you find the instance in busy accounts.

Example 2 — Choose AMI and Instance Type

Name the instance, pick Ubuntu Server, then select a small size for learning.

  1. Give the instance a name (optional but helpful).
  2. Under Application and OS Images (Amazon Machine Image), choose Ubuntu Server (pick a supported LTS release shown in the console).
  3. On Instance type, select a size that matches your workload. For learning, a small burstable type such as t3.micro or t2.micro is often enough (free tier eligibility varies by account and Region—check the console banner).
Launch instance wizard with Ubuntu Server AMI selected
Amazon EC2

How It Works

  1. The AMI decides the OS and default user (Ubuntu uses ubuntu for SSH).
  2. The instance type sets CPU, memory, and price while the VM runs.
  3. Free tier banners in the console are the source of truth for your account.
  4. Root volume size defaults are usually fine for labs; deeper disk options belong in an EBS volumes guide.

Example 3 — Create a Key Pair

Create a login key if you do not already have one for this machine.

  1. Under Key pair (login), choose Create new key pair.
  2. Key pair name — choose any descriptive name.
  3. Key pair type — RSA remains widely compatible.
  4. Private key file format — choose .pem for OpenSSH, or .ppk for PuTTY. The example screenshot uses .ppk; pick the format that matches your client.
  5. Choose Create key pair. Your browser downloads the private key once—store it safely.
EC2 launch wizard create new key pair link
Amazon EC2
Create key pair dialog with RSA and private key format
Amazon EC2

How It Works

  1. AWS keeps the public key on the instance at first boot.
  2. You keep the private key—AWS cannot re-download it later.
  3. .pem vs .ppk is about the client, not about Ubuntu itself.
  4. Losing the file usually means a new key pair and a new instance (or a recovery path).

Example 4 — Configure the Security Group

In Network settings, allow the ports you need to reach the instance.

  1. Allow SSH traffic from your IP or from the internet (narrow SSH to your IP in production).
  2. Allow HTTPS from the internet if you plan to serve TLS.
  3. Allow HTTP from the internet if you plan to serve plain HTTP.
EC2 network settings with SSH HTTP HTTPS rules
Amazon EC2
Production tip.

Opening SSH, HTTP, and HTTPS to 0.0.0.0/0 is convenient for tutorials but increases risk. Prefer restricting SSH to your IP, and place HTTP/HTTPS behind an ALB or CloudFront when you harden the architecture.

How It Works

  1. Security groups are stateful—allowed inbound replies can leave without a matching outbound rule.
  2. SSH (22) is for admin; web ports are only needed if you host a site on the instance.
  3. Source CIDR controls who can connect; 0.0.0.0/0 means the whole internet.
  4. Deeper rule design belongs in a dedicated security groups guide.

Example 5 — Launch and Verify Running

Finish the wizard and wait for a healthy instance.

  1. Review storage and advanced options if needed, then choose Launch instance.
  2. Return to Instances and wait until Instance state shows Running and status checks have passed.
  3. Note the public IPv4 or DNS name for SSH and later DNS—then attach an Elastic IP if you need a stable address.
EC2 launch instance summary and launch button
Amazon EC2
EC2 instances list showing running instance
Amazon EC2

How It Works

  1. Launch provisions the VM from your AMI into the chosen subnet.
  2. Status checks confirm the hypervisor and guest agent look healthy.
  3. Public IP can change after stop/start unless you use Elastic IP.
  4. Next steps: SSH with PuTTY, upload with FileZilla, or install Node.js.

Edge Cases & Pitfalls

Most launch problems are Region, key format, or security group related.

region

Wrong Region selected

Instances are local to a Region. If the list looks empty, check the Region picker before launching again.

key

Lost private key file

AWS will not re-issue the download. Create a new key pair and launch a new instance, or follow an approved recovery path.

ssh

SSH times out

Confirm security group allows TCP 22 from your IP, the instance is Running, and you use the right user (ubuntu for Ubuntu AMIs).

format

.pem used in PuTTY (or reverse)

PuTTY expects .ppk. Convert with PuTTYgen, or download the matching format next time.

cost

Forgot to stop the lab

Running compute and attached EBS keep billing. Stop or terminate when you finish for the day.

ip

Public IP changed after stop

Default public addresses are ephemeral. Use an Elastic IP when DNS or firewall allowlists need a stable IPv4.

Key Takeaways

  • AMI + type: Ubuntu for the OS image; pick a small type for learning.
  • Key pair: download and guard .pem or .ppk—it is how you SSH in.
  • Security group: only open ports you need; tighten SSH sources for production.
  • After Running: Elastic IP, SSH, then deploy your app stack.

One line: AMI + type + key pair + security group, then Launch and wait for Running.

Frequently Asked Questions

The AMI (Amazon Machine Image) is the operating system and preinstalled software template. The instance type defines the virtual hardware: vCPUs, memory, network performance, and instance family.
Choose .pem when you connect with OpenSSH (ssh on macOS, Linux, or modern Windows). Choose .ppk when you use PuTTY on Windows. You can convert between formats with puttygen if needed.
SSH lets you administer the instance. HTTP and HTTPS allow web traffic if you plan to run a site. For production, restrict sources (for example your IP for SSH) instead of opening every port to the entire internet.
Running instances incur compute charges unless covered by free tier or savings plans. EBS volumes and public IPv4 may also bill. Stopping an instance stops compute charges for most types, but you still pay for storage.
Attach an Elastic IP for a stable public address, then connect with PuTTY or OpenSSH. After that you can install runtimes, upload apps, or place the instance behind a load balancer.
Not in place. To switch OS image you typically launch a new instance from a different AMI (or rebuild from a custom AMI) and migrate data.

Next: Elastic IP for EC2

Allocate and associate an Elastic IP so your instance keeps the same public address across restarts and for DNS records.

Elastic IP for EC2 →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful