Skip to content

🌐 Automated personal VPN infrastructure using AWS, Terraform, and Ansible. Deploy secure OpenVPN servers across multiple regions with a single command.

License

Notifications You must be signed in to change notification settings

Krywion/vpn-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Personal VPN Server Infrastructure

🌐 Overview

This project provides an automated solution for deploying and managing personal VPN servers across multiple AWS regions. It combines infrastructure as code (Terraform), configuration management (Ansible), and a convenient Python CLI tool for seamless management.

πŸš€ Features

  • Multi-Region Support: Deploy VPN servers in 14 different AWS regions
  • Automated Deployment: One-command deployment using Terraform
  • Secure Configuration: Hardened server setup with OpenVPN, fail2ban, and UFW
  • Easy Management: Simple CLI tool for deployment, connection, and termination
  • Infrastructure as Code: Full AWS infrastructure defined in Terraform
  • Automated Configuration: Ansible playbooks for consistent server setup

πŸ›  Technology Stack

  • Infrastructure: Terraform
  • Configuration Management: Ansible
  • VPN Software: OpenVPN
  • Cloud Provider: AWS
  • Programming Language: Python
  • Security: UFW, fail2ban

πŸ“‹ Prerequisites

  • AWS Account and configured AWS CLI
  • Terraform installed
  • Ansible installed
  • Python 3.x
  • OpenVPN client

πŸ”§ Installation

  1. Clone the repository
git clone https://github.com/krywion/vpn-project.git
cd vpn-project
  1. Generate SSH key pair
ssh-keygen -t rsa -b 4096 -f ~/.ssh/vpn-key
  1. Configure AWS credentials
aws configure

πŸ’° AWS Costs Disclaimer

This project uses AWS infrastructure which may incur costs to your AWS account. The main components that generate costs:

  • EC2 instance (t2.micro) - around $8-10/month if running 24/7
  • Data transfer costs - varies based on usage:
    • First 1GB/month is free
    • $0.09 per GB up to 10TB/month (varies by region)
    • Inbound data transfer is typically free

To minimize costs:

  • Use the --kill command to terminate the server when not in use
  • Consider using AWS Free Tier if eligible (includes 750 hours of t2.micro per month)
  • Monitor your AWS billing dashboard regularly
  • Set up AWS billing alerts

Note: Costs may vary by region and AWS pricing changes over time. Always check current AWS pricing for the most accurate information.

πŸ’» Usage

The project includes a CLI tool (vpn-connect.py) for managing VPN servers:

# List available regions
python3 vpn-connect.py --list

# Deploy VPN server in a region
python3 vpn-connect.py --server eu-central-1

# Connect to VPN
python3 vpn-connect.py --connect

# Disconnect from VPN
python3 vpn-connect.py --disconnect

# Terminate VPN server
python3 vpn-connect.py --kill eu-central-1

πŸ“ Project Structure

.
β”œβ”€β”€ ansible/
β”‚   β”œβ”€β”€ playbooks/
β”‚   β”œβ”€β”€ roles/
β”‚   └── inventory/
β”œβ”€β”€ terraform/
β”‚   β”œβ”€β”€ main.tf
β”‚   β”œβ”€β”€ vpc.tf
β”‚   └── ...
β”œβ”€β”€ scripts/
β”‚   └── vpn-connect.py
└── README.md

πŸ” Security Features

  • SSH hardening with key-based authentication
  • fail2ban for brute force protection
  • UFW firewall configuration
  • OpenVPN with strong encryption
  • Automatic security updates

🀝 Contributing

Feel free to submit issues, fork the repository and create pull requests for any improvements.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

⚠️ Disclaimer

This project is for educational and personal use. Make sure to comply with AWS terms of service and your local regulations regarding VPN usage.

About

🌐 Automated personal VPN infrastructure using AWS, Terraform, and Ansible. Deploy secure OpenVPN servers across multiple regions with a single command.

Resources

License

Stars

Watchers

Forks