50_ 3‐Tier Architecture in Oracle Cloud Infrastructure (OCI) - Nirvan-Pandey/OCI_DOC GitHub Wiki
50_1: Introduction
A 3-tier architecture is a structured design pattern that separates an application into three distinct layers:
1️⃣ Presentation Layer (Web Tier) – Manages user interface and interactions.
2️⃣ Application Layer (Logic Tier) – Processes business logic and request handling.
3️⃣ Data Layer (Database Tier) – Stores and manages application data.
This architecture promotes modularity, scalability, and security, making it an industry-standard approach for cloud-based applications.
50_2: Understanding the Three Tiers in OCI
-
Presentation Layer (Web Tier)
-
Function: Handles user interactions and displays content.
-
OCI Services Used:
-
OCI Load Balancer → Distributes incoming requests to backend servers.
-
Compute Instances → Runs web server applications (e.g., Apache, Nginx).
-
-
Application Layer (Logic Tier)
-
Function: Processes requests, executes business logic, and communicates between the frontend and database.
-
OCI Services Used:
-
Compute Instances → Hosts backend services (e.g., Java, Node.js, Python).
-
OCI Container Engine for Kubernetes (OKE) → For containerized deployments.
-
-
Data Layer (Database Tier)
-
Function: Stores and manages structured and unstructured data.
-
OCI Services Used:
-
OCI Autonomous Database → Fully managed database for minimal maintenance .
-
OCI MySQL, PostgreSQL, Oracle Database → For custom database solutions.
-
OCI Object Storage → Stores unstructured data (e.g., logs, media files).
-
50_3: 3-Tier Architecture Design in OCI
┌──────────────────────────────┐
│ Internet │
└──────────────▲──────────────┘
│
┌──────────────▼──────────────┐
│ OCI Load Balancer │ (Public Subnet)
└──────────────▲──────────────┘
│
┌───────────────────┴───────────────────┐
│ │
┌────────▼────────┐ ┌────────▼────────┐
│ Web Server 1 │ │ Web Server 2 │ (Public Subnet)
└────────────────┘ └────────────────┘
│ │
└───────────────┬───────────────┘
│
┌───────────▼───────────┐
│ Application Servers │ (Private Subnet)
└───────────▲───────────┘
│
┌───────────▼───────────┐
│ Oracle Database │ (Private Subnet)
└───────────────────────┘
This model ensures secure communication between layers while isolating backend resources from direct internet access.
50_4: Steps to Deploy a 3-Tier Architecture in OCI
-
Step 1: Create a Virtual Cloud Network (VCN) and Subnets
- Set up a VCN with a CIDR block (e.g., 10.0.0.0/16).
- Define three subnets: Public Subnet → For the load balancer and web servers (10.0.1.0/24). Private Subnet → For application servers (10.0.2.0/24). Private Subnet → For the database server (10.0.3.0/24).
-
Step 2: Deploy the Web Tier
- Launch OCI Load Balancer in the public subnet.
- Deploy Compute Instances in the public subnet to host web servers.
- Install a web server (e.g., Apache, Nginx) on the instances.
- Configure security lists to allow HTTP(S) traffic from the internet.
-
Step 3: Deploy the Application Tier
- Deploy Compute Instances in a private subnet.
- Install backend frameworks (e.g., Node.js, Java Spring Boot, Python Flask).
- Configure security rules to allow traffic only from the web tier.
-
Step 4: Deploy the Database Tier
- Launch an OCI Autonomous Database or Oracle Database in a private subnet.
- Configure Network Security Groups (NSG) to restrict access.
- Allow database connections only from the application servers.
-
Step 5: Configure Security & Networking
- Set up security lists for controlled communication: Web Tier → App Tier (Allow HTTP/HTTPS traffic). App Tier → Database Tier (Allow DB connections).
- Define route tables to manage data flow between subnets.
-
Step 6: Enable Scaling & Load Balancing
- Enable Auto-Scaling for web and application servers.
- Configure the OCI Load Balancer to distribute traffic efficiently.
-
Step 7: Deploy & Test the Application
- Deploy application code on application servers.
- Validate end-to-end communication across all layers.
50_5: Why Use a 3-Tier Architecture in OCI?
✅ Improved Security → Private subnets prevent direct database exposure.
✅ Better Scalability → Each layer scales independently based on demand.
✅ High Availability → Load balancers ensure seamless traffic management.
✅ Simplified Maintenance → Modular design allows easier updates and troubleshooting.
By implementing this structure, you can enhance performance, security, and flexibility for cloud applications in Oracle Cloud Infrastructure (OCI). 🚀