<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Midhun on Medium]]></title>
        <description><![CDATA[Stories by Midhun on Medium]]></description>
        <link>https://medium.com/@midhungretta?source=rss-474bd832a50f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*E1dWocoHTG369NXi</url>
            <title>Stories by Midhun on Medium</title>
            <link>https://medium.com/@midhungretta?source=rss-474bd832a50f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:23:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@midhungretta/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built a Scalable 3-Tier Architecture on AWS (Step-by-Step Guide)]]></title>
            <link>https://medium.com/@midhungretta/how-i-built-a-scalable-3-tier-architecture-on-aws-step-by-step-guide-a38a7888d315?source=rss-474bd832a50f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a38a7888d315</guid>
            <category><![CDATA[three-tier-architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Midhun]]></dc:creator>
            <pubDate>Sat, 06 Jun 2026 20:10:33 GMT</pubDate>
            <atom:updated>2026-06-06T20:10:33.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-EumSQCbho6imqjoecU-iA.png" /></figure><p>In this project, I designed and deployed a Scalable Three-Tier Architecture on AWS to simulate how modern web applications are built and managed in production environments.</p><p>The goal was to create a secure, scalable, and highly available application by separating the infrastructure into three independent layers: the Web Tier, Application Tier, and Database Tier.</p><p>To achieve this, I used AWS services including EC2, Application Load Balancer, Route 53, RDS, and SSL/TLS certificates. This architecture demonstrates how user requests flow through multiple layers while maintaining performance, security, and reliability.</p><h4><strong>Architecture Overview:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*HEgY0x_a52HOEvbkveCgJQ.png" /></figure><h3>Step 1: Set up a VPC</h3><ol><li>Go to AWS Management Console → Search for VPC</li><li>Click <strong>Create VPC</strong>.</li><li>In VPC Settings:</li></ol><ul><li>Choose <strong>VPC and more</strong></li><li><strong>Name tag:</strong> mkvpc</li><li><strong>IPv4 CIDR block:</strong> 10.0.0.0/16</li><li><strong>Number of AZs:</strong> 2</li><li><strong>Public subnets:</strong> 2</li><li><strong>Private subnets:</strong> 4</li><li><strong>NAT Gateway:</strong> Zonal</li><li><strong>1 NAT Gateway per AZ</strong></li></ul><p>3. Click <strong>Create VPC</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5WEJHi6_FhMBdzGLheCn1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1eCOz1vsYPBEbwJMSe4J7g.png" /><figcaption>VPC Creation</figcaption></figure><h3>Step 2: Creating Security Groups</h3><p>In this step, I configured <strong>Security Groups</strong> to control how traffic flows between different layers of the architecture on AWS.</p><p>Instead of opening everything, I designed rules based on a <strong>strict traffic flow model</strong>:</p><blockquote><strong><em>Internet Load Balancer → Web Server → Internal Load Balancer → App Server → Database</em></strong></blockquote><p>This ensures <strong>maximum security with controlled access between layers</strong>.</p><h3><strong>1. Internet Load Balancer Security Group:</strong></h3><ul><li><strong>Name:</strong> Internet Load Balancer</li></ul><p>Inbound Rules:</p><ul><li><strong>HTTP (80)</strong> → Source: 0.0.0.0/0</li><li><strong>HTTPS (443)</strong> → Source: 0.0.0.0/0</li></ul><p>Outbound Rules:</p><ul><li>Allow all traffic (default)</li></ul><h3><strong>2. Web Server Security Group:</strong></h3><ul><li><strong>Name:</strong> WebServer</li><li><strong>VPC:</strong> mkvpc</li></ul><p>Inbound Rules:</p><ul><li><strong>HTTP (80)</strong> → Source: Internet Load Balancer SG</li><li><strong>HTTPS (443)</strong> → Source: Internet Load Balancer SG</li><li><strong>SSH (22)</strong> → Source: My IP</li></ul><p>Outbound Rules:</p><ul><li>Allow all traffic (default)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9dOARg9iVzjGJYIxPfW_0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6bcPow9nDxxxCcKGnFz3g.png" /></figure><h3><strong>3. Internal Load Balancer Security Group</strong></h3><ul><li><strong>Name:</strong> Internal Load Balancer</li></ul><p>Inbound Rules:</p><ul><li><strong>HTTP (80)</strong> → Source: Web Server SG</li><li><strong>HTTPS (443)</strong> → Source: Web Server SG</li></ul><p>Outbound Rules:</p><ul><li>Allow all traffic (default)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nh4hdM1hczo8jjkFb161Bg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JnUof8d9JFaBt1QQpDoFQA.png" /></figure><h3><strong>4. Application Server Security Group</strong></h3><ul><li><strong>Name:</strong> AppServer</li></ul><p>Inbound Rules:</p><ul><li><strong>HTTP (80)</strong> → Source: Internal Load Balancer SG</li><li><strong>HTTPS (443)</strong> → Source: Internal Load Balancer SG</li><li><strong>Custom TCP (5000)</strong> → Source: Internal Load Balancer SG <em>(Flask app port)</em></li><li><strong>SSH (22)</strong> → Source: Internal Load Balancer SG</li></ul><p>Outbound Rules:</p><ul><li>Allow all traffic (default)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbqKtq5_aXQ5ZJ1AQ03Yow.png" /></figure><h3><strong>5. Database Security Group</strong></h3><ul><li><strong>Name:</strong> Database</li></ul><p>Inbound Rules:</p><ul><li><strong>MySQL/Aurora (3306)</strong> → Source: App Server SG</li></ul><p>Outbound Rules:</p><ul><li>Default (allow all)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AT1rgaepnHyD3EkBDu2s1A.png" /></figure><h3><strong>Step 3: Setting Up a Custom Domain</strong></h3><h4><strong>Option 1: Use Your Existing Domain</strong></h4><p>If you already own a domain, you can directly use it.</p><p>Example:</p><ul><li>yourdomain.com</li><li>midhuncloud.tech</li></ul><h4>Option 2: Get a Free Domain</h4><p>If you don’t have a domain, you can get a <strong>free domain for 1 year</strong> using the GitHub Education.</p><h3>Steps:</h3><ol><li>Go to GitHub Student Developer Pack</li><li>Verify your student account</li><li>Claim the <strong>.tech domain offer</strong></li><li>Register your domain (e.g., midhuncloud.tech)</li></ol><p>This allows me to access my application using<a href="http://midhuncloud.tech/">http://midhuncloud.tech</a>instead of public IP address</p><h3><strong>Step 4: Configuring Route 53 and Updating Nameservers</strong></h3><p>I configured DNS using Amazon Route 53 to connect my domain to the AWS infrastructure.</p><p>This is a critical step because <strong>owning a domain is not enough</strong> — you must tell the internet <strong>where to route traffic</strong>.</p><h3>1. Create Hosted Zone in Route 53</h3><h3>Steps:</h3><ol><li>Go to Route 53 → Hosted Zones</li><li>Click <strong>Create Hosted Zone</strong></li><li>Enter:</li></ol><ul><li><strong>Domain Name:</strong> midhuncloud.tech</li><li><strong>Type:</strong> Public Hosted Zone</li></ul><p>4. Click <strong>Create Hosted Zone</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aYi7Jq4YoG7Zq5JZIOn50g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmIaUQJ2ZlY0lFZC4FOjSQ.png" /></figure><h4>2. Copy Nameservers from Route 53</h4><p>After creating the hosted zone, you will see 4 NS records like:</p><ul><li>ns-77.awsdns-09.com</li><li>ns-763.awsdns-31.net</li><li>ns-1153.awsdns-16.org</li><li>ns-1948.awsdns-51.co.uk</li></ul><h4>3. Update Nameservers in Domain Provider</h4><p>Go to your domain provider (in your case, .tech domains panel) and:</p><ul><li>Replace existing nameservers</li><li>Paste the Route 53 nameservers</li></ul><p>Then click <strong>Save</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPDhOUsisFmq6BpfEOzSNw.png" /></figure><blockquote><em>By default, your domain provider controls DNS.</em></blockquote><blockquote><em>After updating the nameservers, you are </em><strong><em>delegating DNS control to Route 53</em></strong><em>, which allows AWS to manage how traffic is routed.</em></blockquote><p>Before:</p><pre>User → Domain Provider DNS → (no AWS connection)</pre><p>After:</p><pre>User → Route 53 → Load Balancer → Web → App → Database</pre><blockquote><em>After updating nameservers, it may take </em><strong><em>a few minutes to several hours</em></strong><em> for changes to propagate globally.</em></blockquote><h3><strong>Step 5: Enabling HTTPS with SSL Certificate (ACM + Route 53)</strong></h3><p>I configured secure communication using AWS Certificate Manager and integrated it with Amazon Route 53.</p><p>This ensures that all traffic to my domain is <strong>encrypted (HTTPS)</strong> instead of plain HTTP.</p><p><strong>1. Request a Public Certificate</strong></p><h4>Steps:</h4><ol><li>Go to <strong>AWS Certificate Manager (ACM)</strong></li><li>Click <strong>Request Certificate</strong></li><li>Select:</li></ol><ul><li>Request a public certificate</li><li><strong>Domain name:</strong> midhuncloud.tech</li></ul><p>4. Click <strong>Next</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xr2ZGfh2_sWtAzhuM5pe7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L3qCq6vURHEZqhFAdfcMrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8NLeKLWT_hLJawiO6QY6ZQ.png" /></figure><h4>2. Create Validation Record in Route 53</h4><p>After requesting the certificate:</p><ol><li>Status will be → <strong>Pending Validation</strong></li><li>Click <strong>Create records in Route 53</strong></li><li>Confirm and create</li></ol><p>This automatically adds a <strong>CNAME record</strong> in your hosted zone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_bqIdRndOwP95Vhl6wt7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*klNItpTCoz94mY73XJllWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ts91MJt8VOF02DozXMpfpw.png" /></figure><ul><li>The CNAME record created in Route 53 validates domain ownership by linking your domain to AWS Certificate Manager. It proves to AWS that you <strong>own the domain</strong>.</li><li>Once verified, the certificate status changes from <em>Pending</em> to <em>Issued</em> within a few minutes.</li><li>This enables HTTPS, ensuring secure, encrypted communication and improving user trust.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBRSYzP7DS3MyxnAj6Ts1w.png" /></figure><h3>Step 6: Create DB Subnet Group (Secure Database Layer)</h3><p>I configured database networking using Amazon RDS by creating a DB subnet group with private subnets.</p><p>This ensures the database is <strong>not publicly accessible</strong> and only reachable from internal services like the application layer.</p><h3>1. Create DB Subnet Group</h3><h3>Steps:</h3><ol><li>Go to <strong>Amazon RDS → Subnet groups</strong></li><li>Click <strong>Create DB subnet group</strong></li><li>Enter:</li></ol><ul><li><strong>Name:</strong> Subnet group for DB</li><li><strong>Description:</strong> Subnet group for DB</li></ul><p>4. Select your <strong>VPC</strong></p><h3>2. Select Availability Zones &amp; Subnets</h3><ol><li>I selected multiple availability zones:</li></ol><ul><li>ap-south-1a</li><li>ap-south-1b</li></ul><p>And mapped each AZ with its corresponding <strong>private subnet</strong>:</p><ul><li>private-subnet-1a → ap-south-1a</li><li>private-subnet-1b → ap-south-1b</li></ul><p>2. Click <strong>Create DB subnet group</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58GLxoTmqceZX1fBnU_s3g.png" /></figure><p>Before:</p><pre>Database → Public (Risk ❌)</pre><p>After:</p><pre>Web → App → Database (Private 🔒, Multi-AZ ✅)</pre><h3><strong>Step 7: Create Database in RDS</strong></h3><p>I launched a database using Amazon RDS inside a secure VPC with private subnets.</p><h4>1. Choose Engine</h4><ul><li>Select <strong>MySQL</strong></li><li>Choose <strong>Full configuration</strong></li></ul><h4>2. Select Template</h4><ul><li>Choose <strong>Free tier</strong></li></ul><h4>3. Configure Database</h4><ul><li>DB instance name → mydatabase</li><li>Master username → admin</li><li>Password → set your own password</li></ul><h4>4. Instance &amp; Storage</h4><ul><li>Instance type → db.t4g.micro</li><li>Storage → 20 GB (default)</li></ul><h4>5. Connectivity Setup</h4><ul><li>VPC → select your VPC</li><li>DB subnet group → subnet group for db</li><li>Public access → <strong>No ❌</strong></li><li>Security group → select existing DB SG</li></ul><p>This ensures database is <strong>private and secure</strong></p><h4>6. Availability Zone</h4><ul><li>Choose one AZ (e.g., ap-south-1a)</li></ul><p>Subnet group already handles multi-AZ failover support</p><h4>7. Additional Settings</h4><ul><li>DB port → 3306</li><li>Initial DB name → set your own DB name (eg:cloud )</li><li>Keep defaults for others</li></ul><h4>8. Create Database</h4><ul><li>Click <strong>Create database</strong></li><li>Wait until status → <strong>Available ✅</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AtBb5TTxi8whoddCR6KVCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*svKsSVQ7bA1LaRDOt8oEsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fRcCDjZmDUsZPE7t9WvFJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0e08pZ2d0LktPf8Y2O6qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFsOFomZ-RegwdQJCZzzOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hM_iG1kQRl1r1dhJ4I_5_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eoJzGx3TgpEj-GNH8Yw6QA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kOB9aS857ATxkYzilehqig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGoquI4_IyFf53evRSJIjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8nz4IlmW12xWx6AnHYuCzQ.png" /></figure><h3>Step 8: Create EC2 Instance (Web Server)</h3><ol><li><strong>Name &amp; OS</strong></li></ol><ul><li>Name → Web Server</li><li>AMI → Amazon Linux</li></ul><p><strong>2. Instance Type</strong></p><ul><li>Select → t3.micro (Free tier)</li></ul><p><strong>3. Key Pair</strong></p><ul><li>Create &amp; download .pem file</li></ul><p><strong>4. Network &amp; Security</strong></p><ul><li>Public subnet + Enable public IP</li><li>Allow HTTP (80) &amp; SSH (22)</li></ul><p><strong>5. Launch</strong></p><ul><li>Click Launch → Status = Running</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpzPC1d-FsNvjsisaPIGfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Czw1EYN5tUEpzlHCcBHcLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emcIji2AItCdudif6mWxEA.png" /></figure><h3><strong>Step 9: App Server Setup (Same as Web Server)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e00GhyRzF1h1iLKxfhnNYw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Czw1EYN5tUEpzlHCcBHcLA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VXl4DEl_3MVssA0AFuMpg.png" /></figure><h3>Step 10: Connect Web Server → App Server using PuTTY</h3><ol><li><strong>PuTTY Configuration (Web Server Login)</strong></li></ol><ul><li>Enter Public IP → Copy from EC2 Web Server (eg:3.108.218.80 )</li><li>Port → 22 (SSH)</li><li>Auth → Attach .ppk private key</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*_N1-CQdWkccnukhPFoK7Sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*UC1hbY09_v3jo8f99SFEYw.png" /></figure><ol><li><strong>Login to Web Server</strong></li></ol><ul><li>Username → ec2-user</li><li>Successfully connected to Amazon Linux instance</li></ul><ol><li><strong>Move to App Server (Private Access)</strong></li></ol><ul><li>Copied key file → New.pem</li><li>Set permission → chmod 400 New.pem</li><li>Connected using private IP: ssh -i &lt;Key_Pair name with extension&gt; ec2-user@&lt;Appserver private IP&gt; (eg:ssh -i New.pem ec2-user@10.0.141.84)</li></ul><ol><li><strong>Successful Connection</strong></li></ol><ul><li>Logged into App Server (private instance)</li><li>No public internet access required</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*zUAmlP3jjB03_ds0dS3NHw.png" /></figure><h3>Step 11: Install MySQL &amp; Connect to RDS</h3><ol><li><strong>Install MySQL (MariaDB client)</strong></li></ol><pre>sudo yum install mariadb105 -y</pre><p><strong>2. Check Installation</strong></p><pre>mysql --version</pre><p><strong>3. Connect to RDS Database</strong></p><pre>mysql -h &lt;RDS-ENDPOINT&gt; -P 3306 -u admin -p</pre><p>Example:</p><pre>mysql -h mydatabase.cd8wc62i2eta.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p</pre><p><strong>4. Enter Password</strong></p><ul><li>Type your DB password</li><li>Inside MySQL Shell you will see:</li></ul><pre>MySQL [(none)]&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*CF5tOrgj9IwtiWAJHBAUFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*4n3vJeqeDw0nc7ZgwGHqkg.png" /></figure><h3>Step 12: Create Table &amp; Fetch Data in MySQL</h3><ol><li><strong>Select Database</strong></li></ol><pre>use cloud;</pre><p><strong>2. Create Table</strong></p><pre>CREATE TABLE users (<br>  id INT AUTO_INCREMENT PRIMARY KEY,<br>  username VARCHAR(50) NOT NULL,<br>  password VARCHAR(255) NOT NULL,<br>  email VARCHAR(100) NOT NULL<br>);</pre><p><strong>3. Verify Table</strong></p><pre>show tables;</pre><p><strong>4. Insert Data</strong></p><pre>INSERT INTO users (username, password, email)<br>VALUES<br>(&#39;Brock&#39;, &#39;brock123&#39;, &#39;brock@gmail.com&#39;),<br>(&#39;Midhun&#39;, &#39;midhun123&#39;, &#39;midhun@gmail.com&#39;),<br>(&#39;Tommy&#39;, &#39;tommy123&#39;, &#39;tommy@gmail.com&#39;);</pre><p><strong>5. Fetch Data</strong></p><pre>SELECT * FROM users;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*DcRxLXUJ8Rkea_pAf_tgmA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*xdiaAifcs1bk2xPyhZhpzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*1jszHqD5vAsnudJalj3qYQ.png" /></figure><h3>Step 13: Setup Python App &amp; Connect to Database</h3><ol><li><strong>Install Python &amp; Pip</strong></li></ol><pre>sudo yum install python3 python3-pip -y<br>pip3 install flask flask-mysql-connector flask-cors</pre><ol><li><strong>Create Application File</strong></li></ol><pre>vi app.py</pre><p>👉 Paste your Flask code</p><p>Run Application in Background</p><pre>nohup python3 app.py &gt; output.log 2&gt;&amp;1 &amp;</pre><p><strong>Test API (Inside Server)</strong></p><pre>curl http://localhost:5000/login</pre><h3>What is Happening</h3><ul><li>Flask app is running on <strong>port 5000</strong></li><li>It connects to <strong>RDS MySQL database</strong></li><li>Fetches user data from users table</li><li>Returns response as <strong>JSON API</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*QPzPONMC4vEjltZ3965HSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*R94PDcwDgLMkERSqqNg9rQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*amA9CLuv8y81OwmYzcIqWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*9JpbE4Nefij1obasbL-j-g.png" /></figure><h3><strong>Step 14: Create Frontend (HTML, CSS, JS)</strong></h3><h3>1. Install Apache (Web Server Setup)</h3><pre>sudo yum install httpd -y<br>sudo service httpd start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*D98h59OCYigV3ThTeTAwhQ.png" /></figure><h3>What happens:</h3><ul><li>Installs Apache server</li><li>Starts web service</li><li>Default page = “It works!”</li></ul><p>👉 Browser:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fs-3_LIv--wDYs_f5eVyAw.png" /></figure><pre>http://PUBLIC-IP</pre><p>✔ Means your web server is live</p><h3>2. Go to Web Root Directory</h3><pre>cd /var/www/html/</pre><ul><li>This is where your website files live</li><li>Apache serves files from here</li></ul><h3>3. Create Frontend Files</h3><pre>touch index.html style.css script.js</pre><h3>What happens:</h3><ul><li>index.html → structure</li><li>style.css → design</li><li>script.js → API connection</li></ul><h3>4. Connect Frontend → Backend (JS)</h3><pre>fetch(&quot;http://10.0.141.84:5000/login&quot;)</pre><ul><li>Browser calls Flask API</li><li>Receives data</li><li>Displays on UI</li></ul><p>Now full flow works:</p><pre>Browser → Web Server → App Server → RDS</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*qbotnrVxNeptu9KyWXvGmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*C9SfhskBW9n8E0StHpqCVA.png" /></figure><h3>STEP 15. Create Target Group (for App Server)</h3><ul><li><strong>Target type</strong> → Instances</li><li><strong>Name</strong> → AppServerTG</li><li><strong>Protocol</strong> → HTTP</li><li><strong>Port</strong> → 5000 (Flask app)</li></ul><h3>Network</h3><ul><li><strong>VPC</strong> → same as EC2 (mkvpc-vpc)</li><li><strong>Protocol</strong> → HTTP</li><li><strong>Path</strong> → /login (Because Flask API works on:)</li></ul><pre>http://APP-SERVER:5000/login</pre><h3>Register Target</h3><ul><li>Select <strong>App Server instance</strong></li><li>Port → 5000</li><li>Click → <strong>Include as pending</strong></li><li>Click → <strong>Create target group</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwqnDbixZGnshXpymRIadw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdeA-PHCf5E6IGPoJ2tgCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDy87udGneqQfKva3NhBYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GP9hXsYSNwY7MbPsETS2gw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGIKVbfha6SPFaF9gGRBGA.png" /></figure><h3>2. Create Application Load Balancer (ALB)</h3><ul><li><strong>Name</strong> → BackendLB</li><li><strong>Scheme</strong> → Internet-facing</li><li><strong>IP type</strong> → IPv4</li></ul><h3>Network Mapping</h3><ul><li>Select your <strong>VPC</strong></li><li>Select <strong>2 public subnets</strong> (important)</li><li>Protocol → HTTP</li><li><strong>Port</strong> → 80</li><li>Select → <strong>Forward to target group</strong></li><li>Choose → AppServerTG</li><li>Click → <strong>Create Load Balancer</strong></li></ul><p>This connects ALB → App Server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8zXFK_zp7DbhOldTmRh7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UvRAyE7hAixnhMWw77UvHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XowWnFzU1g_K4Gru2-4VWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1p2BsvdwM6KIK7O2niCq3w.png" /></figure><h3>STEP 16. Create Target Group (for Web Server)</h3><ul><li><strong>Target type</strong> → Instances</li><li><strong>Name</strong> → WebServerTG</li><li><strong>Protocol</strong> → HTTP</li><li><strong>Port</strong> → 80 (Apache / frontend)</li><li><strong>VPC</strong> → same VPC (mkvpc-vpc)</li><li><strong>Protocol</strong> → HTTP</li><li><strong>Path</strong> → /(Because frontend (Apache) loads:)</li></ul><h3>Register Target</h3><ul><li>Select → <strong>Web Server instance</strong></li><li>Port → 80</li><li>Click → <strong>Include as pending</strong></li><li>Click → <strong>Create target group</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEtENfMtBpqj3DR1eF76Gw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BngP-fmzgLvkInt89nyPMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0dI5K_6cjpn90lxTauftxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kD0dC4_g5A80MLE6P_u7ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQmIthLJ89DvQGdjwPr83w.png" /></figure><h3>2. Create Frontend Load Balancer</h3><ul><li><strong>Name</strong> → FrontendLB</li><li><strong>Scheme</strong> → Internet-facing</li><li><strong>IP type</strong> → IPv4</li></ul><h3>Network Mapping</h3><ul><li>Select your <strong>VPC</strong></li><li>Select <strong>2 public subnets</strong></li></ul><p>✔ Required for ALB</p><h3>Security Group (IMPORTANT)</h3><p>Allow:</p><pre>HTTP (80) → 0.0.0.0/0</pre><p>✔ Anyone can access frontend</p><ul><li><strong>Protocol</strong> → HTTP</li><li><strong>Port</strong> → 80</li><li>Choose → <strong>Forward to target group</strong></li><li>Select → WebServerTG</li><li>Click → <strong>Create Load Balancer</strong></li></ul><p>✔ This connects:</p><pre>User → ALB → Web Server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wt4-72TVn0u9WD0kcFOeew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y8GP31YVUAhsojJuJPNbCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W2x11VXW0f7-_3o0ejuNfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgqESYZE1SBz7NxSjQ-qPA.png" /></figure><h3>Open Browser</h3><p>Paste Frontend balancer url :</p><pre>http://frontendLB-DNS</pre><p>✔ User hits frontend load balancer, request goes to web server, JS calls backend load balancer, Flask fetches data from MySQL and returns response to UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-4jdXJL6Gnz7CwRwhDkskw.png" /></figure><h3>FINAL FLOW</h3><pre>Browser<br> ↓<br>Frontend ALB<br> ↓<br>Web Server (HTML + JS)<br> ↓<br>Backend ALB<br> ↓<br>Flask API<br> ↓<br>MySQL DB<br> ↓<br>Back to </pre><h3>STEP 17. Route53 Domain Mapping</h3><p>Go to → Route53 → Hosted Zones →Domain name</p><ul><li>Click → Create Record</li><li>Name → Domain name</li><li>Type → A</li><li>Route to → Application Load Balancer</li><li>Select → FrontendLB</li><li>Routing → Simple</li></ul><p>Click → Create Record</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxTKC1zeyw1AfUs1N0K00A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_CGDIBmx5vk0FflWHHAKTQ.png" /></figure><blockquote><strong>Key Learnings:</strong></blockquote><p>- Designing a secure and scalable 3-tier architecture<br>- Configuring Application Load Balancers and Target Groups<br>- Deploying applications across multiple AWS services<br>- Managing DNS records using Route 53<br>- Understanding networking, security groups, and traffic flow between tiers<br>- Working with managed databases using Amazon RDS</p><h3>Conclusion</h3><p>This project allowed me to design and deploy a scalable 3-tier architecture on AWS using EC2, Application Load Balancer, Route 53, and RDS. By organizing the application into separate web, application, and database layers, I implemented a more secure, reliable, and scalable solution. Overall, this experience enhanced my practical knowledge of AWS services and gave me valuable insight into how production-grade cloud applications are architected and managed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a38a7888d315" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>