Skip to content

theenuka/AWS-Re-Archichitectoring-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Re-Architecting: Cloud-Native Multi-Tier Web Application Deployment

Architecture Diagram


Project Overview

This project represents the next step after the lift-and-shift migration: a full re-architecting of the VProfile application to use AWS managed services in place of manually administered EC2 instances. Where the previous project ran MySQL, Memcached, and RabbitMQ on individual EC2 servers, this project replaces each with purpose-built AWS managed services:

  • Amazon RDS for the database
  • Amazon ElastiCache for caching
  • Amazon MQ (RabbitMQ) for messaging

AWS Elastic Beanstalk manages the application tier deployment, load balancing, and auto scaling automatically.

Amazon CloudFront is introduced as a CDN in front of the application, reducing latency for distributed users and providing edge-based HTTPS termination with an ACM certificate. Route 53 handles public DNS, and CloudWatch provides monitoring. The result is a cloud-native architecture where AWS handles patching, backups, failover, and scaling — shifting focus from server administration to application delivery.


Architecture and Technology Stack

The re-architected system uses a fully managed backend. User requests hit Route 53, which resolves to a CloudFront distribution. CloudFront acts as CDN and HTTPS entry point, forwarding to the Application Load Balancer managed inside Elastic Beanstalk. Beanstalk hosts the Tomcat tier inside an Auto Scaling Group with automatic deployment and health monitoring.

Tomcat connects to three managed services: Amazon RDS (MySQL) for storage, ElastiCache (Memcached) for caching, and Amazon MQ (RabbitMQ) for messaging. These replace the EC2 instances from lift-and-shift. The Beanstalk environment and backend services share a backend security group controlling traffic between tiers.

Component Details
Application Platform AWS Elastic Beanstalk — Tomcat platform, manages ALB, ASG, EC2
Database Amazon RDS — MySQL engine, managed (replaces EC2 project-db01)
Cache Amazon ElastiCache — Memcached engine (replaces EC2 project-mc01)
Message Broker Amazon MQ — RabbitMQ engine (replaces EC2 project-rmq01)
CDN Amazon CloudFront — edge caching + HTTPS with ACM
DNS Route 53 — public routing to CloudFront
Artifact Store Amazon S3 — stores WAR for Beanstalk deployment
Monitoring Amazon CloudWatch — metrics and health
SSL Certificate ACM — attached to CloudFront distribution
Public Domain GoDaddy — CNAME to CloudFront (*.cloudfront.net)
Key Pair EC2 key pair — for Beanstalk instance SSH
AWS Region US East (Ohio) — us-east-2

Flow of Execution

Deployment follows eighteen steps. Managed services are provisioned first because Beanstalk needs their endpoints at build time. Beanstalk environment is created next, backend security group updated, temporary EC2 initializes RDS schema, artifact rebuilt with endpoints and deployed, finally CloudFront and DNS configured.


Step 1: Login to AWS and Set Region

Logged into AWS Console and confirmed region us-east-2. All resources provisioned in same region to minimize latency between Beanstalk and managed services, avoiding inter-region transfer charges.

AWS Console showing us-east-2 region

Figure 2: AWS Console showing us-east-2 region


Step 2: Create Key Pair

Created EC2 key pair vprofile-prod-key for SSH to Beanstalk instances and temporary bastion.

EC2 Key Pair: vprofile-prod-key

Figure 3: EC2 Key Pair: vprofile-prod-key


Step 3: Create Backend Security Group

Created vprofile-theenuka-backend-sg in default VPC for RDS, ElastiCache, Amazon MQ. Rules updated in later steps after Beanstalk SG exists.

Backend security group created

Figure 4: Backend security group created, 1 initial rule (self-referencing all traffic)


Step 4: Create Amazon RDS

Created RDS MySQL parameter group vprofile-rds-theenuka-paragrp (mysql 8.0), subnet group vprofile-rds-theenuka-subgrp across 3 AZs (us-east-2a/2b/2c), then launched vprofile-rds-theenuka (db.t4g.micro, MySQL Community). Endpoint, username admin, password noted for application.properties and schema init.

RDS parameter group

Figure 5: RDS parameter group: vprofile-rds-theenuka-paragrp (mysql8.0)

RDS subnet group

Figure 6: RDS subnet group created: vprofile-rds-theenuka-subgrp

RDS subnet group detail

Figure 7: RDS subnet group detail: 3 subnets across us-east-2a/2b/2c

RDS creation dialog

Figure 8: RDS creation dialog: master username admin, password shown once

RDS status Creating

Figure 9: RDS status Creating, instance vprofile-rds-theenuka

RDS status Available

Figure 10: RDS status Available, MySQL Community engine

RDS connection details

Figure 11: RDS connection details


Step 5: Create ElastiCache Memcached

Created ElastiCache subnet group vprofile-theenuka-cache-subgrp across 3 AZs, then launched vprofile-theenuka-cache (cache.t3.micro, Memcached 1.6.22). Configuration endpoint noted for application.properties.

ElastiCache subnet group

Figure 12: ElastiCache subnet group: vprofile-theenuka-cache-subgrp

ElastiCache subnet group detail

Figure 13: ElastiCache subnet group detail: 3 subnets across us-east-2a/2b/2c

ElastiCache cluster Creating

Figure 14: ElastiCache cluster Creating: vprofile-theenuka-cache

ElastiCache cluster detail

Figure 15: ElastiCache cluster detail: Memcached 1.6.22, cache.t3.micro, 1 node


Step 6: Create Amazon MQ (RabbitMQ)

Created Amazon MQ broker vprofile-theenuka-rabbitmq (mq.t3.micro, RabbitMQ 3.13.7, single-instance deployment). Broker provisioned in default VPC with backend security group. Endpoint and credentials noted for application.properties.

Amazon MQ broker creation

Figure 16: Amazon MQ broker vprofile-theenuka-rabbitmq creation in progress

Amazon MQ broker details

Figure 17: Amazon MQ broker details: RabbitMQ 3.13.7, mq.t3.micro, single-instance broker


Step 7: Update Backend Security Group

Updated backend security group vprofile-theenuka-backend-sg with inbound rules to allow communication between managed services. Added MySQL/Aurora on TCP port 3306 from mysql-SG (for RDS access). These rules enable Elastic Beanstalk instances to connect to RDS, ElastiCache, and Amazon MQ.

Backend SG inbound rules

Figure 18: Backend security group inbound rules: self-referencing All Traffic and MySQL port 3306

RDS connectivity configuration

Figure 19: RDS connectivity configuration showing endpoint, security group, and VPC settings


Step 8: Initialize RDS Database

Launched temporary EC2 instance mysql-client to initialize RDS schema. Instance placed in same VPC with security group allowing SSH from local IP. Connected via SSH, installed MySQL client, cloned vprofile-project repository, and executed db_backup.sql against RDS endpoint. Verified schema creation with show tables confirming role, user, and user_role tables in accounts database. Instance terminated after successful initialization.

Temporary EC2 instance mysql-client

Figure 20: Temporary EC2 instance mysql-client running in us-east-2c

Git clone and MySQL connection

Figure 21: Terminal session: git clone vprofile-project, MySQL client connection to RDS

MySQL show tables

Figure 22: MySQL "show tables" output confirming schema initialization: role, user, user_role


Step 9: Backend Security Group Internal Traffic

Self-referencing rule already configured in backend security group (from Step 3) allowing all internal backend communication between RDS, ElastiCache, and Amazon MQ. This rule enables managed services to communicate with each other within the backend tier.


Step 10: Create IAM Instance Profile for Beanstalk

Created IAM role vprofile-theenuka-beanrole with AWS managed policies for Elastic Beanstalk. Attached policies:

  • AdministratorAccess-AWSElasticBeanstalk
  • AWSElasticBeanstalkCustomPlatformforEC2Role
  • AWSElasticBeanstalkRoleSNS
  • AWSElasticBeanstalkWebTier

Instance profile ARN noted for Beanstalk environment creation.

IAM role for Beanstalk

Figure 23: IAM role vprofile-theenuka-beanrole with 4 AWS managed Elastic Beanstalk policies


Step 11: Create Elastic Beanstalk Environment

Created Elastic Beanstalk environment Vprofile-theenuka-beanapp-prod with Tomcat 10 with Corretto 21 on 64bit Amazon Linux platform. Environment provisioned with Application Load Balancer, Auto Scaling Group, EC2 instances, and CloudWatch monitoring. Domain vprotheenuka.us-east-2.elasticbeanstalk.com assigned. Health status OK after initialization.

Beanstalk environment Health OK

Figure 24: Elastic Beanstalk environment successfully launched with Health OK

Beanstalk welcome page

Figure 25: Default Elastic Beanstalk welcome page accessible via HTTP


Step 12: Update Backend Security Group for Beanstalk

Updated backend security group vprofile-theenuka-backend-sg with additional inbound rules from Beanstalk security group. Total 3 rules:

  1. All Traffic from self-referencing
  2. All Traffic from Beanstalk instances
  3. MySQL/Aurora port 3306

This allows Beanstalk EC2 instances to access RDS, ElastiCache, and Amazon MQ.

Backend SG with Beanstalk rules

Figure 26: Backend security group with 3 inbound rules including Beanstalk access


Step 13: Build Application Artifact with Updated Endpoints

Updated application.properties with managed service endpoints:

  • RDS: vprofile-rds-theenuka.ct48oimksl08.us-east-2.rds.amazonaws.com:3306
  • ElastiCache: vprofile-theenuka-cache.eymywt.cfg.use2.cache.amazonaws.com:11211
  • Amazon MQ: broker endpoint

Executed mvn install to build vprofile-v2.war. Build completed successfully.

Maven build process

Figure 27: Maven build process: compiling resources, test resources, and packaging WAR

Maven BUILD SUCCESS

Figure 28: Maven BUILD SUCCESS: vprofile-v2.war created


Step 14: Deploy Application to Elastic Beanstalk

Uploaded vprofile-v2.war to Elastic Beanstalk environment with version label Vprofile-theenuka-beanapp-version-1.9. Deployment policy set to Rolling with health threshold Ok and batch size 50% instances. Deployment completed successfully, environment health transitioned from Degraded to Info to OK. New application version deployed to running EC2 instances.

Beanstalk deploy dialog

Figure 29: Upload and deploy dialog: vprofile-v2.war with Rolling deployment policy

Beanstalk update completed

Figure 30: Environment update completed successfully, running version 1.9

VProfile login page

Figure 31: VProfile application login page accessible via Beanstalk URL (HTTP)


Step 15: Add HTTPS Listener to Application Load Balancer

Added HTTPS listener on port 443 to Elastic Beanstalk Application Load Balancer. Attached ACM SSL certificate *.theenuka.xyz covering custom domain. SSL policy set to ELBSecurityPolicy-TLS13-1-2-2021-06. Default process routes traffic to Beanstalk target group on port 80.

HTTPS listener configuration

Figure 32: HTTPS listener configuration with ACM certificate and TLS 1.3 security policy


Step 16: Create DNS CNAME Record

Created CNAME record vprorearch.theenuka.xyz pointing to Beanstalk ALB domain vprotheenuka.us-east-2.elasticbeanstalk.com. TTL set to 1/2 Hour for faster propagation during testing. Record saved in domain DNS management, enabling custom domain access to application.

CNAME record creation

Figure 33: CNAME record creation: vprorearch pointing to Beanstalk ALB


Step 17: Verify Application via Custom Domain with HTTPS

Verified end-to-end application deployment via custom domain vprorearch.theenuka.xyz over HTTPS. Certificate validation confirmed, browser shows "Connection is secure" with valid certificate. Login page loads successfully, user authentication functional with admin_vp credentials. Users list page displays data from RDS MySQL database, confirming backend connectivity. Application fully operational on cloud-native re-architected infrastructure.

Application via custom domain

Figure 34: Application accessible via custom domain vprorearch.theenuka.xyz with login page

Browser security

Figure 35: Browser security: "Connection is secure" with valid certificate

User authenticated

Figure 36: User authenticated

Users list from RDS

Figure 37: Users list page: data retrieved from RDS MySQL database confirming backend connectivity


Step 18: Create CloudFront Distribution

Created CloudFront distribution vprofile-theenuka with origin pointing to Elastic Beanstalk ALB. Alternate domain name vprorearch.theenuka.xyz configured with ACM certificate *.theenuka.xyz for HTTPS. Distribution deployed globally across all edge locations with TLSv1.2_2021 security policy. Status Enabled, providing CDN caching and edge HTTPS termination for improved global performance.

CloudFront distribution

Figure 38: CloudFront distribution with alternate domain vprorearch.theenuka.xyz and SSL certificate

DNS CNAME updated to CloudFront

Figure 39: DNS CNAME updated to point to CloudFront domain

CloudFront distribution Enabled

Figure 40: CloudFront distribution Enabled with global edge deployment


Re-Architecting vs Lift-and-Shift

Key difference: managed services (RDS, ElastiCache, MQ, Beanstalk) vs self-managed EC2. Application code identical, infrastructure ownership shifts to AWS. Reduced operational overhead, automated patching/backups/failover.


Technical Skills Demonstrated

  • Provisioned Amazon RDS, ElastiCache, Amazon MQ replacing EC2 instances
  • Deployed Java app via Beanstalk managing EC2, ALB, ASG
  • Implemented CloudFront CDN with ACM certificate for edge HTTPS termination
  • Updated application.properties with managed service endpoints before Maven rebuild
  • Temporary EC2 bastion for RDS schema initialization
  • Two-phase security group updates after Beanstalk creation

Conclusion

Project completes progression: local virtualized → cloud lift-and-shift → cloud re-architecting. VProfile now runs on entirely managed infrastructure. AWS handles availability, patching, backups, and scaling.

Key lesson: application code is identical across all three approaches. What differs is infrastructure management responsibility. Re-architecting delegates operational burden to AWS managed services while maintaining identical application functionality.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors