Project
In this project, we embarked on the journey of architecting and deploying a highly scalable and robust multi-tier application on Amazon Web Services (AWS). Our application is designed to handle a diverse range of services, employing a combination of technologies to deliver a seamless user experience.
Application Architectural Overview
Our multi-tier application, employing a combination of services to ensure high availability, scalability, and performance. Here's a short overview of architecture:
* Load Balancer (Nginx)
Incoming user requests are first received by the NGINX load balancer. NGINX distributes these requests evenly among the available web servers to ensure load balancing. This ensures high availability and performance by spreading the traffic load.
* Web Servers (Apache)
The web servers receive incoming requests from the load balancer. They are responsible for processing HTTP requests and serving web content to users. In this tier, your application logic is executed, handling tasks such as authentication, data retrieval, and processing. The web servers also interact with the next tier, the message broker, for background tasks and asynchronous processing.
* Message Broker (RabbitMQ)
RabbitMQ is used for asynchronous communication and task queuing. If your web servers need to perform tasks that are time-consuming or can be executed in the background (e.g., sending emails, processing large data, or managing workflows), they can send messages to RabbitMQ queues. These messages are then picked up by worker processes to execute the tasks, ensuring scalability and responsiveness
* Database Server (MySQL)
When the web servers require or update data, they interact with the MySQL database server. This database server stores and manages your application's data, including user information, content, and any other information your application relies on. It's crucial for maintaining the persistence and integrity of your data.
* Application Flow Of Executation
In summary, the flow of execution in your multi-tier AWS-hosted application starts with the load balancer distributing incoming requests to the web servers. The web servers handle application logic and can delegate time-consuming tasks to the RabbitMQ message broker for asynchronous processing. Finally, data is retrieved or stored in the MySQL database server, ensuring the high availability, scalability, and performance of your application.
AWS Architectural Overview
Creating an AWS architecture to host your multi-tier application involves deploying various AWS services to ensure scalability, availability, and security. Here's a short overview of an AWS-based architecture for your application:
* EC2 Instances (Virtual Servers)
These are your Elastic Compute Cloud (EC2) instances. They host your application components such as Apache, RabbitMQ, and any other software required. You can configure these instances for optimal performance and scale them as needed to handle traffic spikes.
* Security Groups
Security groups act as virtual firewalls for your EC2 instances. They define inbound and outbound traffic rules, ensuring that only authorized traffic can access your instances. For example, you might allow HTTP traffic (port 80) to your web servers but restrict SSH access (port 22) to trusted IP addresses.
* ELB - Elastic Load Balancer
The Elastic Load Balancer distributes incoming traffic across multiple EC2 instances. It helps ensure high availability, load balancing, and fault tolerance for your application. When one instance fails or becomes overloaded, ELB automatically routes traffic to healthy instances.
* Autoscaling
Auto Scaling allows your application to automatically adjust the number of EC2 instances based on predefined scaling policies. It ensures your application can handle varying levels of traffic efficiently. You can set up scaling triggers to add or remove instances as needed, reducing costs during low-traffic periods.
* EFS / S3
These are storage solutions. S3 is object storage for static files, like images and other assets, and can be used for backups. EFS, on the other hand, provides scalable, shared file storage for your EC2 instances. It's suitable for sharing files and configurations between instances, which can be especially useful for your multi-tier application.
* Route 53 (DNS Service)
Route 53 is Amazon's scalable and highly available Domain Name System (DNS) web service. It routes traffic to your application by resolving domain names to the appropriate ELB or EC2 instance. It can also provide health checks to route traffic away from unhealthy instances.
By combining these components, you've built a robust and scalable architecture for your multi-tier application on AWS. It can handle increased loads, adapt to changing traffic patterns, and ensure high availability and fault tolerance. Additionally, AWS's infrastructure provides the flexibility and scalability needed to grow your application as your user base expands.
AWS Flow of Executation
* Create Key Pairs
Key pairs are used for secure SSH access to your EC2 instances. You generate a key pair, keep the private key secure, and use the public key to authenticate and access your instances.
* Create Security Groups
Security groups are like virtual firewalls for your AWS resources. Creating separate security groups for ELB, Tomcat instances, and databases (RabbitMQ, Memcache, MySQL) allows you to control inbound and outbound traffic access, ensuring security and proper communication between different components
* Launch Instances for User Data:
You launch EC2 instances for your application, configuring user data scripts to run on instance launch. These scripts can set up the environment and install necessary software, making instance provisioning automated and consistent.
* Update IP to Name Mapping in Route 53
Route 53 is Amazon's DNS service. Updating IP to name mapping involves creating DNS records, such as A or CNAME records, to associate friendly domain names with the IP addresses of your application components, making them accessible via human-readable URLs.
* Build Application from Source Code:
You compile or build your application from its source code, preparing it for deployment. This step ensures that your application is in a deployable state.
* Upload to S3 Bucket
Amazon S3 is a scalable object storage service. Uploading your application artifacts to an S3 bucket makes them easily accessible to other AWS services and instances, ensuring efficient deployment and distribution.
* Download Artifact to Tomcat Instance:
After uploading your application to S3, you download the application artifact to your Tomcat instances. This step makes the application available on the instances, where it can be deployed and run.
* Setup ELB for HTTP:
Elastic Load Balancer (ELB) is used to distribute incoming traffic across multiple instances. Configuring ELB for HTTP involves setting up listener rules, health checks, and routing, ensuring that traffic is evenly distributed to your Tomcat instances.
* Build Auto Scaling Group for Tomcat Instances
Auto Scaling allows your Tomcat instances to automatically adjust the number of running instances based on demand. By creating an Auto Scaling group, you ensure that your application can handle varying levels of traffic, maintaining high availability and scalability.
Each of these steps plays a crucial role in setting up and deploying your application on AWS, from securing access to instances, managing traffic, and ensuring your application is accessible and scalable.
App Technologies
NGINX
APACHE
RABBITMQ
MYSQL
JAVA
AWS Services
EC2 Instances
ELB Load Blancer
Auto-Scaling
S3
Route 53
Security Groups
Back