Welcome to Day 5 of your AWS 30-Day Roadmap.
If you have been following along, you know the history (Day 1), the core services (Day 2), the console layout (Day 3), and how to store files (Day 4).
Today, things get real.
Today, we are going to launch a virtual computer in the cloud. We are going to log into it. We are going to install a web server on it. And we are going to make it host a website that anyone in the world can visit.
Amazon EC2 (Elastic Compute Cloud) is the heart of AWS. It is the service that started the cloud revolution. It allows you to rent a computer (an “instance”) for pennies an hour, use it to crunch numbers or host a website, and then throw it away when you are done.
In this ultimate guide, we will move beyond the “Next, Next, Finish” tutorials. We are going to dissect every single option in the Launch Wizard—AMIs, Instance Types, Key Pairs, and Security Groups—so you understand exactly what you are building.
The EC2 Anatomy (What makes a Server?)
Before we click “Launch,” you need to understand the four ingredients that make up an EC2 instance. Think of this like buying a custom PC.
1. The AMI (Amazon Machine Image)
- Analogy: The Operating System disc.
- What is it? A template that contains the software configuration (Operating System, Application Server, and Applications) required to launch your instance.
- Common Choices:
- Amazon Linux 2023: AWS’s own Linux. Lightweight, secure, and free. (We will use this).
- Ubuntu: The popular developer-friendly Linux.
- Windows Server: For .NET applications (Costlier due to licensing).
2. The Instance Type (The Hardware)
- Analogy: The CPU and RAM.
- What is it? AWS offers hundreds of hardware combinations. They are named with a code like
t2.microorc5.large. - The Code Decoded:
- Family (e.g., ‘t’): Describes the capability (T = General Purpose/Burstable).
- Generation (e.g., ‘2’): The version number (2 is older than 3).
- Size (e.g., ‘micro’): The capacity (Nano < Micro < Small < Medium < Large).
- For Beginners: Always stick to t2.micro or t3.micro. These are “Free Tier Eligible.”
3. The Key Pair (The Key)
- Analogy: The physical key to your house.
- What is it? EC2 instances (Linux) generally do not use passwords. They use Cryptography.
- How it works: You download a private key file (
.pem) to your laptop. AWS keeps the public lock. You can only enter the server if you have the.pemfile. - Warning: If you lose this file, you are locked out forever. There is no “Forgot Password” button.
4. The Security Group (The Firewall)
- Analogy: The Bouncer at the club door.
- What is it? A virtual firewall that controls traffic for your instance.
- Rules: You define rules like “Allow SSH (Port 22) from my IP only” or “Allow HTTP (Port 80) from Anywhere.”

Step-by-Step Lab: Launching Your Web Server
Enough theory. Let’s build.
Goal: Launch a Linux server, install Apache Web Server, and see a “Hello World” page.
Step 1: Open the Wizard
- Log into your AWS Console (Day 3).
- Ensure you are in N. Virginia (us-east-1).
- Search for EC2.
- Click the big orange “Launch instance” button.
Step 2: Name and OS
- Name:
day5-web-server. - Application and OS Images (AMI): Select Amazon Linux.
- AMI Dropdown: Ensure “Amazon Linux 2023 AMI” is selected (Free Tier Eligible).
Step 3: Choose Instance Type
- Instance Type: Select
t2.micro(ort3.microif t2 is unavailable). Look for the “Free tier eligible” tag.
Step 4: Create a Key Pair
- Key pair (login): Click “Create new key pair”.
- Key pair name:
day5-key. - Key pair type: RSA.
- Private key file format:
- Select
.pem(For Mac/Linux or Windows 10+ PowerShell). - Select
.ppk(Only if you use the old PuTTY software).
- Select
- Click Create key pair.
- Action: The file will download. Do not lose it.
Step 5: Network Settings (The Firewall)
- Network Settings: Click “Edit” (Optional, but good to see).
- Security Group: Select “Create security group”.
- Allow SSH traffic: Check this. Change “Anywhere” to “My IP”. (Security Best Practice!).
- Allow HTTP traffic from the internet: CHECK THIS. This opens Port 80 so the world can see your website.
Step 6: Advanced Details (The Magic Script)
This is the “Pro” move. Instead of logging in to install software, we will tell AWS to do it while the server boots.
- Scroll all the way down to Advanced details.
- Scroll to the bottom field: User data.
- Paste this script exactly:
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello from Day 5! This is my first AWS Server.</h1>" > /var/www/html/index.html
- What does this do? It updates Linux, installs Apache (httpd), starts the server, and creates a simple HTML homepage.
Step 7: Launch
- Click Launch instance.
- Wait for the “Success” screen.
- Click View all instances.

Connecting to Your Instance
Your server is running (State: Running). But how do you see it?
Method 1: The Web Browser Test
- Select your instance in the list.
- Look at the bottom details pane. Find Public IPv4 address (e.g.,
54.123.45.67). - Copy it.
- Open a new browser tab and paste it (ensure it is
http://nothttps://). - Result: You should see big bold text: “Hello from Day 5! This is my first AWS Server.”
- Troubleshooting: If it loads forever, check your Security Group. Did you allow HTTP (Port 80)?
Method 2: SSH (The Terminal)
If you want to run commands manually, you need to “SSH” (Secure Shell) into it.
The Easy Way: EC2 Instance Connect
- Select your instance.
- Click the Connect button (top right).
- Select the EC2 Instance Connect tab.
- Click Connect.
- Result: A browser window opens with a black terminal screen. You are now inside your server! Try typing
whoami. It should sayec2-user.

Instance Lifecycle (Stop vs. Terminate)
This is the most expensive mistake beginners make. You need to know the difference between “Stopping” and “Terminating.”
1. Stop Instance
- Action: Like shutting down your laptop lid.
- Data: The hard drive (EBS volume) is preserved. Nothing is lost.
- Billing: You stop paying for the Compute (EC2 hourly rate), BUT you keep paying for the Storage (EBS).
- IP Address: You lose your Public IP address (it changes when you start again).
2. Terminate Instance
- Action: Like throwing your laptop into a volcano.
- Data: The hard drive is deleted (by default). Everything is lost.
- Billing: You pay $0. Everything is gone.
- Use Case: When you are done with a lab or experiment.
Rule: For this roadmap, always Terminate your resources at the end of the day unless you plan to use them tomorrow.

Elastic IP (The Static Address)
You noticed that when you “Stop” and “Start” an instance, the IP address changes. This is bad for a web server. You want a permanent address.
Elastic IP (EIP) is a static IPv4 address designed for dynamic cloud computing.
- How to get one: EC2 Dashboard -> Network & Security -> Elastic IPs -> Allocate.
- How to use it: Action -> Associate Elastic IP -> Select your instance.
- The Cost Trap:
- If the EIP is attached to a running instance = FREE.
- If the EIP is sitting idle (not attached) = YOU PAY HOURLY.
- Why? Because IPv4 addresses are scarce. AWS punishes you for hoarding them without using them.
EC2 Pricing Models (How to Pay)
On Day 1 we said “Pay-as-you-go,” but there are actually 4 ways to buy EC2.
- On-Demand:
- Pay by the second. No contract. Most flexible. Highest price.
- Best for: Short-term workloads (like this roadmap).
- Reserved Instances (RI):
- Contract for 1 or 3 years.
- Discount up to 72%.
- Best for: Databases or core servers that never turn off.
- Savings Plans:
- Similar to RIs but more flexible (commit to $10/hour rather than specific hardware).
- Best for: Enterprise steady-state usage.
- Spot Instances:
- Bid on unused AWS capacity.
- Discount up to 90%.
- Risk: AWS can terminate your instance with a 2-minute warning if they need the capacity back.
- Best for: Batch processing, rendering, things that can be interrupted.

Conclusion & Cleanup
You did it. You launched a server, hosted a website, and learned how to secure it.
Cleanup Task (Crucial!):
- Go to the EC2 Dashboard.
- Select your
day5-web-server. - Click Instance state -> Terminate instance.
- Confirm.
- Wait. Ensure the state says
Terminated. - Why? Even
t2.microhas a monthly limit. If you leave it running for 30 days, you might eat up your Free Tier. Good habits start now.
Tomorrow, on Day 6, we will look at EBS (Elastic Block Store)—the hard drive of the cloud. We will learn how to detach a hard drive from one server and attach it to another.
Server shutdown initiated. See you tomorrow.
Can’t stand the suspense? Skip the wait! Members unlock the next chapter instantly and get exclusive early access to every future update.
Become a Member








