Chapter 5: Amazon EC2 (Elastic Compute Cloud)
5.3 How to launch an EC2 instance (console, step by step)
Chala, aata actual launch karuya. Open the console and do every step along with me. Before you start: sign in to the AWS Management Console, and select the Mumbai (ap-south-1) region from the top-right region menu.
Step 1 — Open EC2. Search "EC2" in the top search bar → EC2 Dashboard → Launch instance.
Step 2 — Name and tags. Name: web-server-1. (This creates a tag Name=web-server-1.)
Step 3 — Choose an AMI. Under Application and OS Images choose one of:
- Amazon Linux 2023 AMI (default, free-tier eligible) — user
ec2-user - Ubuntu Server 24.04 LTS (or 22.04 LTS) — user
ubuntu - CentOS Stream 9 — search Browse more AMIs → AWS Marketplace / Community AMIs for the official "CentOS Stream 9" image — user
ec2-user(older CentOS images usedcentos)
Keep architecture 64-bit (x86) unless you chose a Graviton type.
Step 4 — Instance type. Choose a free-tier eligible type such as t3.micro or t2.micro (label shown in the list).
Step 5 — Key pair (login). Click Create new key pair → name mykey → type RSA or ED25519 → format .pem (for OpenSSH on Linux/Mac/Windows 10+) or .ppk (for PuTTY) → Create. The file downloads only once — keep it safe.
Step 6 — Network settings. Click Edit:
- VPC: default VPC; Subnet: No preference (or pick an AZ)
- Auto-assign public IP: Enable
- Firewall (security groups): Create security group, name
web-sg, with inbound rules:
| Type | Protocol | Port | Source | Why |
|---|---|---|---|---|
| SSH | TCP | 22 | My IP (e.g. 49.36.12.7/32) |
Only you can log in |
| HTTP | TCP | 80 | Anywhere-IPv4 0.0.0.0/0 |
Website |
| HTTPS | TCP | 443 | Anywhere-IPv4 0.0.0.0/0 |
Secure website |
Step 7 — Configure storage. Default root volume 8 GiB gp3 (Ubuntu defaults to 8 GiB; you can set up to 30 GiB within typical free-tier storage limits).
Step 8 — Advanced details (optional). Paste a User data script to auto-install a web server at first boot, for example on Amazon Linux 2023:
#!/bin/bash
yum install -y nginx
echo "<h1>Hello from $(hostname -f)</h1>" > /usr/share/nginx/html/index.html
service nginx start
systemctl enable nginx
Step 9 — Launch. Review the Summary panel → Launch instance → View all instances. Wait until Instance state = Running and Status checks = 2/2 checks passed. Copy the Public IPv4 address.
Step 10 — Test. If you used the user-data script, open http://<PUBLIC_IP> in a browser (note: http, not https).
The browser shows a timeout?
Almost always one of: (1) security group does not allow port 80 from 0.0.0.0/0, (2) you typed https:// but no TLS is configured, (3) the web server is not running, (4) instance is in a subnet without a route to an Internet Gateway, or (5) no public IP assigned.