Introduction
As part of my hands-on learning in cloud and cybersecurity fundamentals, I decided to launch and configure my first AWS EC2 instance from scratch — including networking rules, storage, a bootstrap script, and remote access via SSH. This post walks through every step I took, along with the reasoning behind key configuration choices.
1. Instance Configuration
I started by selecting the AMI and instance type:
- AMI: Amazon Linux 2023
- Instance Type: t3.micro (Free Tier eligible)
Amazon Linux 2023 was chosen for its lightweight footprint and long-term AWS support, and t3.micro keeps things within Free Tier limits — ideal for learning and testing.
2. Storage Configuration
I attached two 8 GB EBS volumes to the instance for storage.
3. Bootstrap Script (User Data)
Under Advanced Details → User Data, I added a simple script to serve a "Hello World" page automatically on launch:
#!/bin/bash
dnf update -y
dnf install httpd -y
systemctl start httpd
systemctl enable httpd
echo "HELLO WORLD" > /var/www/html/index.html
touch file1.txt
mkdir dir1
This automates web server installation and setup so the instance is ready to serve content as soon as it boots — no manual SSH configuration needed for the basic page.
4. Security Group (Inbound Rules)
This is where network access control comes in. I configured the following inbound rules:
| Type | Protocol | Port | Source |
|---|---|---|---|
| HTTPS | TCP | 443 | 0.0.0.0/0 (Anywhere) |
| SSH | TCP | 22 | My IP |
Why this matters: HTTPS is opened to everyone since the web page is meant to be publicly accessible, but SSH is restricted to My IP only — this is a basic but important security practice to prevent unauthorized remote access attempts from random IPs across the internet.
5. Launching the Instance
After reviewing the configuration, I launched the instance and downloaded the .pem key pair for SSH authentication.
6. Connecting via SSH
I used MobaXterm as my SSH client. Before connecting, I set the correct permissions on the key file:
chmod 400 instance32.pem
Then connected to the instance via SSH using the public IP along with the .pem private key file for authentication.
7. Verifying the Result
Finally, I opened the instance's public IP directly over HTTPS in the browser (no key file needed here — that's only required for SSH authentication) and confirmed the "Hello World" page was being served correctly.
Key Takeaways
- Automating setup with User Data scripts saves manual configuration time on boot
- Restricting SSH to a single IP while keeping HTTP/HTTPS open is a standard, practical security pattern
- Always set correct permissions (
chmod 400) on your.pemkey before connecting — AWS/SSH will reject overly permissive key files - Free Tier resources (t3.micro, 8GB volumes) are more than enough for learning and small test deployments
This was a hands-on exercise as part of my ongoing cloud and cybersecurity learning journey. Feedback and suggestions welcome!








Top comments (0)