Devops Class Assignment
BTech CSET 230
Architecture Requirements
1. Networking Layer
Create a VPC
2 Public Subnets (different Availability Zones)
2 Private Subnets
Internet Gateway + Route Tables
NAT Gateway (for private subnet access)
2. Compute Layer
Launch EC2 instances in private subnets
Use a Launch Template
Install a simple web server (Apache/Nginx via user_data)
3. Load Balancing
Create an Application Load Balancer (ALB)
Route traffic to EC2 instances
Health checks must be configured
4. Security
Security Groups:
o ALB: Allow HTTP (80)
o EC2: Allow traffic only from ALB
No direct public access to EC2 instances
Terraform Requirements (Important)
🔹 1. Modularization (MANDATORY)
Split your code into reusable modules:
vpc/
ec2/
alb/
Each module must have:
[Link]
[Link]
[Link]
🔹 2. Variables (MANDATORY)
Use variables for:
Region
Instance type
AMI ID
CIDR blocks
Subnet ranges
Desired capacity
Use a [Link] file.
🔹 3. Outputs
Export:
ALB DNS name
VPC ID
Subnet IDs
🔹 4. State Management
Configure remote backend using:
o S3 bucket
o DynamoDB for state locking
Expected Folder Structure
terraform-project/
│
├── [Link]
├── [Link]
├── [Link]
├── [Link]
│
├── modules/
│ ├── vpc/
│ ├── ec2/
│ ├── alb/
Expected Outcome
After terraform apply:
A working ALB DNS URL serving a web page
EC2 instances running in private subnets
Infrastructure is modular and reusable
Marking Scheme (20 Marks)
Component Marks
VPC & Networking Setup 4
EC2 + ASG Configuration 4
Load Balancer Setup 3
Modular Code Structure 4
Proper Use of Variables 2
Outputs & Code Clarity 2
Remote Backend (S3 + DynamoDB) 1
GPT Code -12