Skip to content

Chaitanya5068/Terraform-AWS-VPC-MySQL-Infrastructure-Setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Terraform AWS VPC & MySQL Infrastructure Setup


🌟 Project Overview

This project demonstrates secure AWS infrastructure provisioning using Terraform (Infrastructure as Code).

The infrastructure includes:

  • 🌐 Custom VPC
  • 🌍 Public & Private Subnets
  • πŸ” Security Groups
  • πŸšͺ Internet Gateway
  • πŸ”„ NAT Gateway
  • πŸ’» Bastion Host EC2
  • πŸ›’οΈ MySQL Server in Private Subnet

The project follows real-world cloud security and networking practices.


🎯 Objectives

βœ… Create AWS infrastructure using Terraform

βœ… Implement public & private subnet architecture

βœ… Configure secure network communication

βœ… Deploy MySQL server in private network

βœ… Use Bastion Host for secure access

βœ… Automate provisioning using IaC


πŸ—οΈ Architecture Diagram

AWS Infrastructure Architecture

architecture png

πŸ“ Project Structure

Terraform-AWS-VPC-MySQL-Infrastructure-Setup/
β”‚
β”œβ”€β”€ provider.tf
β”œβ”€β”€ variables.tf
β”œβ”€β”€ terraform.tfvars
β”œβ”€β”€ main.tf
β”œβ”€β”€ nat.tf
β”œβ”€β”€ security.tf
β”œβ”€β”€ outputs.tf
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ images/
β”‚   └── architecture.png
β”‚
└── .gitignore

βš™οΈ Technologies Used

Tool Purpose
Terraform Infrastructure as Code
AWS Cloud Provider
EC2 Compute Service
VPC Networking
NAT Gateway Private Internet Access
MySQL Database
Linux Server OS
Git & GitHub Version Control

🌐 Infrastructure Components

πŸ”Ή VPC

  • CIDR Block: 10.0.0.0/16
  • DNS Support Enabled

πŸ”Ή Public Subnet

  • Hosts Bastion EC2
  • Internet Accessible

πŸ”Ή Private Subnet

  • Hosts MySQL Server
  • No Direct Internet Access

πŸ”Ή NAT Gateway

  • Allows outbound internet access for private subnet

πŸ”Ή Security Groups

Public Security Group

  • SSH Access (Port 22)

Private Security Group

  • MySQL Access (3306)
  • SSH only from Bastion Host

πŸš€ Terraform Workflow

Start
 β”‚
 β–Ό
Write Terraform Code
 β”‚
 β–Ό
terraform init
 β”‚
 β–Ό
terraform plan
 β”‚
 β–Ό
terraform apply
 β”‚
 β–Ό
AWS Resources Provisioned
 β”‚
 β–Ό
Verify Infrastructure
 β”‚
 β–Ό
terraform destroy
 β”‚
 β–Ό
End

πŸš€ Getting Started

πŸ”Ή Initialize Terraform

terraform init

πŸ”Ή Validate Configuration

terraform validate

πŸ”Ή Preview Infrastructure

terraform plan

πŸ”Ή Deploy Infrastructure

terraform apply

πŸ”Ή Destroy Infrastructure

terraform destroy

πŸ“Š Outputs

βœ… VPC ID

βœ… Public & Private Subnet IDs

βœ… EC2 Instance IDs

βœ… Public IP of Bastion Host

βœ… Private IP of MySQL Server


πŸ” Best Practices Followed

βœ… Infrastructure as Code (IaC)

βœ… Secure Private Database Deployment

βœ… Network Isolation

βœ… Security Group Restrictions

βœ… Modular & Clean Terraform Structure


🧠 Key Learnings

  • AWS Networking Concepts
  • VPC Architecture
  • Terraform Automation
  • Infrastructure as Code
  • Cloud Security Best Practices
  • Linux Server Management

πŸ‘¨β€πŸ’» Author

Chaitanya Bhosale

πŸ”— GitHub: https://github.com/Chaitanya5068

πŸ”— LinkedIn: https://www.linkedin.com/in/chaitanya-bhosale


⭐ Support

If you found this project useful, give it a ⭐ on GitHub!


πŸ“Œ Note

This project is created for educational and learning purposes to demonstrate Terraform-based AWS infrastructure provisioning.

About

Infrastructure Provisioning using Terraform: Creating a VPC with Public and Private Subnets and Deploying EC2 with MySQL in a Private Network

Topics

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages