Skip to content

omarionya/aws-vpc-ec2-rds-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS VPC + EC2 + RDS Terraform Project

Project Overview

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.

Goals

  • 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.

Prerequisites

Before running this project, ensure you have the following:

AWS Account

  • Active AWS account with permissions to create VPCs, EC2, RDS, NAT/IGW, Security Groups, and Route Tables.
  • Recommended: IAM user with AdministratorAccess.

Local Machine

  • Terraform v1.x or later
  • AWS CLI installed and configured (aws configure)
  • SSH client (OpenSSH, PuTTY, etc.)
  • Code editor (VS Code, Sublime, etc.)

Knowledge / Skills

  • Basic understanding of AWS networking (VPC, subnets, IGW, NAT Gateway)
  • EC2 usage and SSH connections
  • MySQL basics
  • Terraform workflow: init, plan, apply, destroy

Required Files

  • Terraform configuration files (main.tf, variables.tf, output.tf)
  • SSH key pair for EC2 instances

Expected Costs

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

Releases

No releases published

Packages

 
 
 

Contributors