A production-ready AWS infrastructure setup for deploying a simple web server on EC2 with proper security configuration.
This repository contains AWS CLI scripts to provision an EC2 instance with Apache web server, including VPC, Security Group, and public access configuration.
- AWS CLI (>= 2.0)
- AWS Account with appropriate permissions
- AWS credentials configured (
aws configure)
# 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- 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
Internet
↓
Security Group (HTTP/SSH)
↓
EC2 Instance (Apache)
| Resource | Value |
|---|---|
| Instance Type | t2.micro |
| AMI | Ubuntu 22.04 LTS |
| Region | eu-west-3 |
| Storage | 8GB gp3 |
| Type | Protocol | Port | Source |
|---|---|---|---|
| HTTP | TCP | 80 | 0.0.0.0/0 |
| SSH | TCP | 22 | Your IP |
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
./deploy.shThis will:
- Create a Security Group
- Launch an EC2 instance
- Install and configure Apache
- Display the public URL
./get-instance-info.sh./cleanup.shWarning: This will terminate the instance and delete all associated resources.
After deployment, access your web server at:
http://<PUBLIC_IP>
To SSH into the instance:
ssh -i ~/.ssh/your-key.pem ubuntu@<PUBLIC_IP>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
- 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.
MIT