This project demonstrates a complete AWS infrastructure deployment using Terraform. It is designed to help you understand how VPC networking, subnets, routing, security groups, EC2 instances, NAT Gateway, Internet Gateway, and RDS work together in a secure and scalable architecture.
- Deploy a VPC with one public subnet and two private subnets (in different Availability Zones).
- Launch EC2 instances in public and private subnets.
- Create a private RDS MySQL database in the private subnets for redundancy.
- Configure Internet Gateway for public access and NAT Gateway for private subnet internet access.
- Set up security groups to control inbound and outbound traffic.
- Demonstrate Terraform infrastructure as code for AWS resources.
Before running this project, ensure you have the following:
- Active AWS account with permissions to create VPCs, EC2, RDS, NAT/IGW, Security Groups, and Route Tables.
- Recommended: IAM user with
AdministratorAccess.
- Terraform v1.x or later
- AWS CLI installed and configured (
aws configure) - SSH client (OpenSSH, PuTTY, etc.)
- Code editor (VS Code, Sublime, etc.)
- Basic understanding of AWS networking (VPC, subnets, IGW, NAT Gateway)
- EC2 usage and SSH connections
- MySQL basics
- Terraform workflow:
init,plan,apply,destroy
- Terraform configuration files (
main.tf,variables.tf,output.tf) - SSH key pair for EC2 instances
Although most resources are free-tier eligible, some AWS services incur charges. Approximate monthly costs:
| Resource | Notes | Estimated Cost |
|---|---|---|
| EC2 t2.micro | Free-tier eligible; public and private instances | $0–$10 |
| RDS db.t3.micro | MySQL, 20GB storage | $15–$20 |
| NAT Gateway | Charged per hour + data processed | ~$30 |
| EIP (Elastic IP) | Charged if unused | $0 if associated |
| Internet Gateway | No extra cost | Free |
| EBS Storage | For EC2 instances | ~$1–2 per instance |
Tip: Always destroy the stack after testing to avoid unnecessary charges:
terraform destroy