<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dipak Prasad</title>
    <description>The latest articles on DEV Community by Dipak Prasad (@dipakprasad22).</description>
    <link>https://dev.to/dipakprasad22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3639235%2F652db598-0a2d-49ae-952b-df20d04dcad1.png</url>
      <title>DEV Community: Dipak Prasad</title>
      <link>https://dev.to/dipakprasad22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dipakprasad22"/>
    <language>en</language>
    <item>
      <title>Building a Production-Grade AWS 3-Tier Java Application</title>
      <dc:creator>Dipak Prasad</dc:creator>
      <pubDate>Wed, 04 Feb 2026 17:45:17 +0000</pubDate>
      <link>https://dev.to/dipakprasad22/building-a-production-grade-aws-3-tier-java-application-hands-on-19o1</link>
      <guid>https://dev.to/dipakprasad22/building-a-production-grade-aws-3-tier-java-application-hands-on-19o1</guid>
      <description>&lt;p&gt;A hands-on project building a production-grade 3-tier Java application on AWS using Auto Scaling, ALB, RDS MySQL with Proxy, Redis caching, and secure networking. The focus is on real-world architecture, security, scalability, and operational best practices rather than demo-level setups.&lt;/p&gt;

&lt;p&gt;This article walks through everything I built, step by step, and explains why each component exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We’re Building
&lt;/h2&gt;

&lt;p&gt;At the end of this project, the application looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
 ↓
Route 53
 ↓
CloudFront
 ↓
Application Load Balancer
 ↓
EC2 Auto Scaling Group
 ↓               ↓
Redis Cache   RDS Proxy
                 ↓
         RDS MySQL + Read Replica
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Technology Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Backend: &lt;code&gt;Java, Spring Boot&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Compute: &lt;code&gt;EC2 Auto Scaling Group&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Networking: &lt;code&gt;VPC, Subnets, IGW, NAT Gateway&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Load Balancing: &lt;code&gt;Application Load Balancer&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Database: &lt;code&gt;Amazon RDS MySQL + Read Replica&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;DB Connections: &lt;code&gt;Amazon RDS Proxy&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Secrets: &lt;code&gt;AWS Secrets Manager (automatic rotation)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Cache: &lt;code&gt;Amazon ElastiCache (Redis)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Edge: &lt;code&gt;CloudFront&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;DNS: &lt;code&gt;Route 53&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Access: &lt;code&gt;Bastion Host&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Security: &lt;code&gt;IAM Roles, Security Groups&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  PHASE 1: NETWORKING (FOUNDATION)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3p3ters17jm72ienzw12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3p3ters17jm72ienzw12.png" alt="AWS Subnets" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create VPC&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create Subnets (8 total)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Public Subnets (2 total)

&lt;ul&gt;
&lt;li&gt;Used for Load Balancer, NAT Gateway, Bastion Host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Private App Subnets (2 total)

&lt;ul&gt;
&lt;li&gt;Used for EC2 Auto Scaling Group&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Private DB Subnets (2 total)

&lt;ul&gt;
&lt;li&gt;Used for RDS, RDS Proxy, Read Replica&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Private Cache Subnets (2 total)

&lt;ul&gt;
&lt;li&gt;Used for Redis (ElastiCache)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Internet Gateway&lt;/strong&gt; - Allows public subnets to access the internet.

&lt;ul&gt;
&lt;li&gt;Create Internet Gateway&lt;/li&gt;
&lt;li&gt;Attach Internet Gateway to VPC&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway&lt;/strong&gt; - Private subnets need outbound-only internet access.

&lt;ul&gt;
&lt;li&gt;Create a NAT Gateway in public subnet and allocate an elastic IP.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Tables&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Public Route Table

&lt;ul&gt;
&lt;li&gt;Route: &lt;code&gt;0.0.0.0/0&lt;/code&gt; → &lt;code&gt;Internet Gateway&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Subnet Associate: &lt;code&gt;public-a&lt;/code&gt;, &lt;code&gt;public-b&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Private Route Table

&lt;ul&gt;
&lt;li&gt;Route: &lt;code&gt;0.0.0.0/0&lt;/code&gt; → &lt;code&gt;NAT Gateway&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Subnet Associate: &lt;code&gt;private-app-*&lt;/code&gt;, &lt;code&gt;private-db-*&lt;/code&gt;, &lt;code&gt;private-cache-*&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;ALB Security Group (alb-sg)

&lt;ul&gt;
&lt;li&gt;Inbound: &lt;code&gt;80, 443&lt;/code&gt; from &lt;code&gt;0.0.0.0/0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;8080&lt;/code&gt; to &lt;code&gt;app-sg&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Bastion Security Group (bastion-sg)

&lt;ul&gt;
&lt;li&gt;Inbound: &lt;code&gt;SSH (22)&lt;/code&gt; &lt;code&gt;from your IP&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;SSH&lt;/code&gt; to &lt;code&gt;app-sg&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;App Security Group (app-sg)

&lt;ul&gt;
&lt;li&gt;Inbound: &lt;code&gt;8080&lt;/code&gt; from &lt;code&gt;alb-sg&lt;/code&gt;, &lt;code&gt;22&lt;/code&gt; from &lt;code&gt;bastion-sg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;All&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DB Security Group (db-sg)

&lt;ul&gt;
&lt;li&gt;Inbound: &lt;code&gt;3306&lt;/code&gt; from &lt;code&gt;app-sg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;Local&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Redis Security Group (redis-sg)

&lt;ul&gt;
&lt;li&gt;Inbound: &lt;code&gt;6379&lt;/code&gt; from &lt;code&gt;app-sg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;Local&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  PHASE 2: COMPUTE LAYER
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;strong&gt;Bastion Host&lt;/strong&gt; - This is the only SSH entry point.

&lt;ul&gt;
&lt;li&gt;Subnet: &lt;code&gt;public-a&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Public IP: &lt;code&gt;Enabled&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;SG: &lt;code&gt;bastion-sg&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create an &lt;strong&gt;Application Load Balancer&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Type: &lt;code&gt;Application&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Scheme: &lt;code&gt;Internet-facing&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Subnets: &lt;code&gt;public-a&lt;/code&gt;, &lt;code&gt;public-b&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;SG: &lt;code&gt;alb-sg&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;Target Group&lt;/strong&gt; - ALB routes traffic to target groups, not directly to EC2.

&lt;ul&gt;
&lt;li&gt;Target type: &lt;code&gt;Instance&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Port: &lt;code&gt;8080&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Health check path: &lt;code&gt;/health&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;Launch Template&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;AMI: &lt;code&gt;Ubuntu&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Instance type: &lt;code&gt;t3.micro&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;SG: &lt;code&gt;app-sg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;IAM Role: &lt;code&gt;ec2-app-role&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;User data:   &lt;em&gt;&lt;code&gt;#!/bin/bash
  sudo apt update -y &amp;amp;&amp;amp; sudo apt upgrade -y
  sudo apt install default-jdk git -y
          sudo apt install maven -y&lt;/code&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create an &lt;strong&gt;Auto Scaling Group&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Subnets: &lt;code&gt;private-app-a&lt;/code&gt;, &lt;code&gt;private-app-b&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Min: 1&lt;/code&gt; | &lt;code&gt;Desired: 2&lt;/code&gt; | &lt;code&gt;Max: 3&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Attach ALB target group&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  PHASE 3: DATABASE LAYER
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create DB Subnet Group (RDS must know which private subnets to use) and select private DB subnets.&lt;/li&gt;
&lt;li&gt;Create RDS MySQL database&lt;/li&gt;
&lt;li&gt;Create AWS Secret Manager for DB password and enable autamatic rotation.&lt;/li&gt;
&lt;li&gt;Create Read Replica&lt;/li&gt;
&lt;li&gt;Create RDS Proxy&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  PHASE 4: REDIS CACHE
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create Cache Subnet Group and select private cache subnets&lt;/li&gt;
&lt;li&gt;Create Redis Cluster&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  PHASE 5: Cloudfront &amp;amp; Route53
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Request SSL Certificate&lt;/li&gt;
&lt;li&gt;Create CloudFront Distribution&lt;/li&gt;
&lt;li&gt;Create a hosted zone record &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Source Code &lt;a href="https://github.com/dipakprasad22/AWS-3tier-Java-Spring-Boot-App.git" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;To run the application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/dipakprasad22/AWS-3tier-Java-Spring-Boot-App.git
mvn clean package
java -Xms256m -Xmx512m -jar app.jar
curl http://localhost:8080/health
http://&amp;lt;ALB-DNS-NAME&amp;gt;/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>devops</category>
      <category>devopsproject</category>
      <category>aws</category>
      <category>java</category>
    </item>
  </channel>
</rss>
