LAB 48 ::‐ 3 TIER APPLICATION SETUP... - guptasanjeev-52/oci_docs GitHub Wiki
Now, From this Lab we will Learn Extreme level of Advance Networking. (Industry Level)
Three Tier Architecture ::- 3-Tier Architecture is a design in which an application is divided into three layers: Web Tier, Application Tier, and Database Tier.
The Web Tier handles user requests, the Application Tier processes the requests, and the Database Tier stores the data.
In OCI, we can create a Spoke VCN with three separate subnets: Web Subnet, App Subnet, and Database Subnet. We use security lists to control network traffic and a Load Balancer to distribute incoming requests. The main benefit is better security, separation of responsibilities, and easier management.
A 3-Tier Application Architecture is a way to divide an application into three separate layers: Web Tier, Application Tier, and Database Tier. Each tier has its own responsibility. In OCI, we can use a Spoke VCN with three subnets to separate these layers and manage network security. This setup helps us understand subnet design, traffic flow, security lists, gateways, and load balancing.
1.) Tier 1 — Web Tier (public)
The Web Tier is the first layer through which users access the application.
Purpose::- To receive and handle web requests from users.
- It serves web pages to users.
- It can use web servers such as Apache or NGINX.
- HTTP normally uses TCP port 80, and HTTPS normally uses TCP port 443.
- A Load Balancer can distribute incoming requests to configured backend servers.
- In our basic design, the Web Subnet is public-facing.
2.) Tier 2 — Application Tier (Private)
The Application Tier handles the main processing of the application.
Purpose::- To process requests and perform application tasks.
- It runs the application server or application code.
- It processes user requests.
- It communicates with the Web Tier and Database Tier.
- It is placed in a private subnet in our basic design.
- It should accept traffic only from authorized sources.
3.) Tier 3 — Database Tier
The Database Tier stores and manages application data.
Purpose::- To store, retrieve, and update data when required.
- It stores information such as customer details, product information, and orders.
- The Application Tier communicates with the database when data is needed.
- It is placed in a private database subnet in our basic design.
- Database access should be allowed only from authorized application servers.
Main OCI Components..
- Spoke VCN: Provides a virtual network for the application resources. - Web Subnet: Hosts the public-facing entry point and web resources, depending on the design. - App Subnet: Hosts the application server in a private network. - Database Subnet: Hosts the database in a private network. - Security Lists: Control permitted inbound and outbound traffic at the subnet level. - Load Balancer: Distributes incoming requests across configured backend servers. - Internet Gateway (IGW): Provides a route for permitted internet traffic to and from public resources. - NAT Gateway: Allows private resources to initiate outbound internet connections without requiring public IP addresses.
Basic Security Rules..
Always give App subnet CIDR.. Traffic only For Web Subnet Can go to the App Subnet and Only the Traffic From App Subnet traffic goes to the Database Subnet..
- Allow HTTP/HTTPS traffic to the public-facing entry point when required.
- Allow application traffic only from the authorized Web Tier or Load Balancer, according to the design.
- Allow database traffic only from the authorized Application Tier.
- Do not expose the database directly to the public internet.
- Configure route tables and security lists according to the required traffic flow.
Security List...
1.) WEB SUBNET ::- ( Ingress >> 0.0.0.0/0 // Egress >> App subnet CIDR.)
2.) APPLICATION (App) SUBNET ::- ( Ingress >> Web Subnet CIDR // Egress >> Both Web/Database subnet CIDR.)
3.) DATABASE SUBNET ::- ( Ingress >> App Subnet CIDR // Egress >> App subnet CIDR.)
Gateway...
1.) WEB SUBNET ::- Internet Gateway.
2.) APPLICATION (App) SUBNET ::- NAT / Service Gateway.
3.) DATABASE SUBNET ::- DB is very secure and isolated place. So we don't give any Gateway. Only we give the single Way that reach to the Database with the help of Security List From the Application Subnet Only Traffic Goes their...
Conclusion
A 3-Tier Application Setup separates the web, application, and database functions into different layers. In OCI, using separate subnets in a Spoke VCN helps organize resources and control traffic between them. This is a basic introduction to 3-Tier Architecture, subnet design, security lists, gateways, and Load Balancer traffic flow.
Now, Setting Up the 3 Tier Architecture. Creating 3 Subnets in Spoke Vcn with Dedicated Route Tables and Security Lists
Creating spoke_3tier_vcn in the spoke-network_compartment..
Creating 3 Subnets according to the 3 Tier Architecture..
Creating Security list for 3 Subnets..
Now, Creating Gateways.. Internet, NAT and Service Gateways..
Creating Route Tables for subnets, attaching it to subnet, and adding the gateways in the route rules..
Internet Gateway is attached to web_subnet-rt NAT and Service Gateway are attached to app_subnet-rt