Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/atulkamble/aws-ec2-static-website

This repository provides a step-by-step guide for deploying a static website on AWS EC2. It includes instructions for launching an EC2 instance, installing and configuring the Apache web server, and deploying a basic HTML website. The project also features an optional script for automating the deployment process.
https://github.com/atulkamble/aws-ec2-static-website

apache aws ec2 iac infrastructure-as-code static-website web-hosting website

Last synced: 20 days ago
JSON representation

This repository provides a step-by-step guide for deploying a static website on AWS EC2. It includes instructions for launching an EC2 instance, installing and configuring the Apache web server, and deploying a basic HTML website. The project also features an optional script for automating the deployment process.

Awesome Lists containing this project

README

        

# Hosting a Static Website on AWS EC2
# Clone This Repository
```bash
git clone https://github.com/atulkamble/aws-ec2-static-website.git
cd aws-ec2-static-website
```

# AWSWebsiteProject
**Hosting a Website on AWS EC2**

This project provides a comprehensive guide for configuring and hosting a static website on AWS EC2, including relevant code snippets for setup and deployment.

---

### **Project: Hosting a Static Website on AWS EC2**

**Objective:**
Establish and deploy a static website on an AWS EC2 instance.

---

### **Prerequisites**

1. **AWS Account:** Ensure you have an active AWS account.
2. **AWS CLI:** Install and configure the AWS Command Line Interface (CLI). [Download AWS CLI](https://aws.amazon.com/cli/)
3. **EC2 Key Pair:** Generate an EC2 key pair for secure instance access.
4. **Git:**
```bash
git config --global user.name "username"
git config --global user.email "[email protected]"
```

---

### **Step 1: Launch an EC2 Instance**

1. **Access AWS Management Console** and navigate to the EC2 Dashboard.

2. **Initiate Instance Launch:**
- Select “Launch Instance”.
- Choose an Amazon Machine Image (AMI): Opt for the “Amazon Linux 2 AMI”.
- Select an Instance Type: Choose “t2.micro” (eligible for the free tier).
- Configure Instance: Accept the default configuration settings.
- Add Storage: Accept the default storage configuration.
- Add Tags: (Optional) Add a tag such as `Name: EC2WebServer`.
- Configure Security Group: Create a new security group with rules allowing HTTP (port 80) and SSH (port 22) traffic.
- Review and Launch: Verify settings and click “Launch”. Select your key pair and proceed with launching the instance.

---

### **Step 2: Connect to Your EC2 Instance**

1. **Open your terminal** (Linux/Mac) or use PuTTY (Windows).

2. **Establish SSH Connection:**
```bash
ssh -i /path/to/your-key-pair.pem ec2-user@your-ec2-public-dns
```

---

### **Step 3: Install and Configure Apache Web Server**

1. **Update the instance and install Apache HTTP Server:**
```bash
sudo yum update -y
sudo yum install -y httpd
```

2. **Start Apache service and enable it to start on boot:**
```bash
sudo systemctl start httpd
sudo systemctl enable httpd
sudo usermod -a -G apache ec2-user
```

---

### **Step 4: Deploy Your Static Website**

1. **Create a basic HTML file:**
```bash
sudo tee /var/www/html/index.html <

My First AWS Website


Hello, World!


Welcome to my website hosted on AWS EC2!