AWS EC2 Launch Guide

Prepared by: Anwer Sadath Abdul Muttaliff

Project Overview

This guide provides step-by-step instructions to launch a website on AWS EC2. It covers:

Step 1: Create Your AWS Account

Sign Up for AWS

If you don’t already have an AWS account, sign up at aws.amazon.com.

Step 2: Launch an EC2 Instance

Log in to Your AWS Account

Go to the AWS Management Console.

Search for EC2

Type "EC2" in the search bar and click on EC2.

Launch an Instance

Click on Instances in the left sidebar, then click Launch Instances.

Launch Instance Screenshot
Name Your Instance

Name your instance my_web_server and select Amazon Linux as the AMI.

Name Instance Screenshot
Choose Instance Type

Select the t2.micro instance type (free tier eligible).

Instance Type Screenshot
Create a Key Pair

Create a new key pair and download the .pem file. This will be used to connect to your instance.

Configure Network Settings

Under Network Settings:

Security Group Screenshot
Add User Data

Scroll down to Advanced Details and paste the following script in the User Data section:

#! /bin/bash
yum update -y
yum install httpd -y
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html

Click Launch Instance.

Step 3: Verify Your Instance

Check Instance Status

In the Instances section, you should see your instance my_web_server running.

Instance Running Screenshot
Access Your Website

Copy the Public IP Address of your instance and paste it into your browser (e.g., http://<public-ip>).

You should see: Hello World from <hostname>.

Step 4: Upload Your Website Files

Check Connection

Ping your instance to ensure it’s reachable:

ping <public-ip>

If the ping fails, update your security group to allow ICMP traffic.

Inbound Rules Screenshot
Upload Files

Use the scp command to upload your website files:

scp -i my_web_server_ec2.pem -r /path/to/your/website/* ec2-user@<public-ip>:/var/www/html/
SCP Screenshot
Extract Files

SSH into your instance and extract the files:

ssh -i my_web_server_ec2.pem ec2-user@<public-ip>
cd /var/www/html
sudo tar -xzf myweb4.gz.tar .
SSH Screenshot

Step 5: Assign an Elastic IP (Optional)

Allocate Elastic IP

To avoid losing your public IP when the instance stops:

  1. Go to Elastic IPs in the EC2 Dashboard.
  2. Allocate a new Elastic IP and associate it with your instance.

Release the Elastic IP when not in use to avoid charges.

Back to Top Back to Home