Skip to content

A production-ready AWS infrastructure setup for deploying a simple web server on EC2 with proper security configuration.

DevKylian/aws-ec2-webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS EC2 Web Server

A production-ready AWS infrastructure setup for deploying a simple web server on EC2 with proper security configuration.

Overview

This repository contains AWS CLI scripts to provision an EC2 instance with Apache web server, including VPC, Security Group, and public access configuration.

Prerequisites

  • AWS CLI (>= 2.0)
  • AWS Account with appropriate permissions
  • AWS credentials configured (aws configure)

Quick Start

# Clone the repository
git clone https://github.com/devkylian/aws-ec2-webserver.git
cd aws-ec2-webserver

# Deploy the infrastructure
./deploy.sh

# Get the public IP
./get-instance-info.sh

What's Inside

  • EC2 Instance: t2.micro (Free tier eligible)
  • OS: Ubuntu 22.04 LTS
  • Web Server: Apache 2.4
  • Region: eu-west-3 (Paris)
  • Security: HTTP (80) and SSH (22) access

Architecture

Internet
    ↓
Security Group (HTTP/SSH)
    ↓
EC2 Instance (Apache)

Configuration

Default Settings

Resource Value
Instance Type t2.micro
AMI Ubuntu 22.04 LTS
Region eu-west-3
Storage 8GB gp3

Security Group Rules

Type Protocol Port Source
HTTP TCP 80 0.0.0.0/0
SSH TCP 22 Your IP

Project Structure

aws-ec2-webserver/
├── README.md
├── deploy.sh                    # Main deployment script
├── cleanup.sh                   # Cleanup script
├── get-instance-info.sh         # Display instance details
├── user-data.sh                 # EC2 initialization script
└── .gitignore

Usage

Deploy Infrastructure

./deploy.sh

This will:

  1. Create a Security Group
  2. Launch an EC2 instance
  3. Install and configure Apache
  4. Display the public URL

Get Instance Information

./get-instance-info.sh

Cleanup Resources

./cleanup.sh

Warning: This will terminate the instance and delete all associated resources.

Accessing Your Server

After deployment, access your web server at:

http://<PUBLIC_IP>

To SSH into the instance:

ssh -i ~/.ssh/your-key.pem ubuntu@<PUBLIC_IP>

Customization

Edit deploy.sh to customize:

  • Instance type
  • Region
  • Security group rules
  • User data script

Edit user-data.sh to customize:

  • Installed packages
  • Web server configuration
  • Application deployment

Cost Estimation

  • t2.micro: Free tier eligible (750 hours/month)
  • Storage: ~$0.80/month for 8GB
  • Data Transfer: First 100GB free

Always check current AWS pricing for your region.

License

MIT

About

A production-ready AWS infrastructure setup for deploying a simple web server on EC2 with proper security configuration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages