Project: Launch a Simple Web Server on EC2
By the end of this lesson, you'll be able to:
- Walk through the full EC2 workflow: AMI, instance type, networking, storage, launch, connect, and test
- Install and start a basic web server on a freshly launched Linux instance
- Apply this module's cost-awareness discipline before creating a real resource
Prerequisites: "Starting, Stopping, and Pricing EC2 Instances"
Before you begin: two valid paths, and a real cost decision
As in earlier modules, you can follow this project directly in a real AWS account, or read through it without creating anything. Unlike Module 1's walkthroughs, this one genuinely can create a real, potentially billable resource if you follow along in a real account — check your AWS account's current Free Tier eligibility and the current EC2 pricing page before launching anything, per Lesson 6, rather than assuming a small training instance is automatically free.
The workflow, end to end
- Choose an AMI — a current, AWS-provided Linux AMI is a reasonable starting choice for this project (Lesson 2).
- Choose an instance type — a general-purpose type, per Lesson 2's reasoning, fits a simple web server with no unusual demands.
- Configure networking and security — a security group allowing inbound HTTP (port 80) from anywhere, and SSH restricted to your own location, not
0.0.0.0/0(Lesson 4). - Configure storage — the default root volume is enough for this project (Lesson 5).
- Launch — using a key pair you control the private key for (Lesson 3).
- Connect — over SSH once the instance is Running.
- Install and start a web server — see the commands below.
- Test — request the instance's public address in a browser and confirm the web server responds.
Installing and starting the web server
Once connected over SSH, three commands are enough to get a basic web server running on a common Linux AMI (the exact package name can vary slightly by distribution — check your specific AMI's documentation if a command doesn't match):
sudo yum update -y
sudo yum install -y httpd
sudo systemctl start httpd
yum update refreshes the system's installed packages. yum install httpd installs a standard web server package. systemctl start httpd starts it. After this, requesting your instance's public address on port 80 in a browser should return the web server's default page — a small, satisfying confirmation that the entire chain (networking, security group, instance, software) is working together correctly.
Cost & Cleanup
This project creates a real instance if you followed along in a real account. Once you've confirmed it works and you're done experimenting:
- Check your AWS account's current Free Tier eligibility and the current EC2 pricing page — don't assume this specific configuration is free.
- Decide whether you're continuing to the next lesson's cleanup walkthrough right away, or leaving the instance running briefly for further practice — but don't leave a training instance running indefinitely "just in case."
- The next lesson, "Cleaning Up: Terminating EC2 Resources Safely," is not optional busywork — treat it as the second half of this project, not a separate topic.
Connecting to the newly launched instance
ssh -i YOUR_KEY.pem USER@YOUR_INSTANCE_HOST
YOUR_KEY.pem is your own downloaded private key file — never a real key committed anywhere. USER is the default login user for your chosen AMI. YOUR_INSTANCE_HOST is the instance's public address, available once it reaches the Running state.
Installing and starting a basic web server
sudo yum update -y
sudo yum install -y httpd
sudo systemctl start httpd
Run these after connecting over SSH. The first command refreshes installed packages, the second installs a standard web server, and the third starts it. sudo runs each command with administrative privileges, which installing software and managing system services requires.
Exercise
Before launching the instance for this project, write down: (1) which instance type family you'd choose and why, (2) what your security group should allow inbound, and from where, for both HTTP and SSH, and (3) one thing you'll check before considering this project "done and safe to leave running."
Show hint
Revisit Lesson 2 for the instance type, Lesson 4 for the security group, and this lesson's Cost & Cleanup section for the third answer.
Project: Launch a Simple Web Server on EC2 Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
This project ties every lesson in this module into one workflow — choosing an AMI and instance type, configuring networking and storage, launching, connecting over SSH, and installing a basic web server — while treating cost-awareness as a first-class part of the process, not an afterthought.