Deploying Multi-Tier Webapp On AWS Using Managed Services
Deploying Multi-Tier Webapp On AWS Using Managed Services
Tasks Page No
ii Architectural Design 3
4 Create RDS 14
7 DB Initialization 35
9 Update the security group of backend to allow traffic from the Beanstalk Security 50
group
14 Credits 64
1
Deploying the Simple multi tier web application on AWS using managed services
SL.No Services
1 EC2 instances
2 ELB
3 Autoscaling
4 RDS
5 Elastic Cache
6 Active MQ
7 IAM
8 Cloudwatch
9 Git
10 Maven
2
Deploying the Simple multi tier web application on AWS using managed services
Architectural Design
3
Deploying the Simple multi tier web application on AWS using managed services
2. If you don’t have an IAM user account follow the below steps , open IAM by searching it
4
Deploying the Simple multi tier web application on AWS using managed services
4. Now you can see the Dashboard for creating IAM User, we have 3 Steps
Step 1 : Specify user details
Step 2 : Set permissions
Step 3 : Review and create
5
Deploying the Simple multi tier web application on AWS using managed services
6
Deploying the Simple multi tier web application on AWS using managed services
7
Deploying the Simple multi tier web application on AWS using managed services
9. Logout from the root user aws console and open the URL at browser (URL : previously copied)
Now login as IAM user, by entering username and password , next click on Sign In
8
Deploying the Simple multi tier web application on AWS using managed services
10. It’s done , now you logged in AWS Console with IAM user
You can check your username at top right corner as iam-username@ root-user-name
You can check at Region N.Virginia , by clicking the regions dropdowns besides
9
Deploying the Simple multi tier web application on AWS using managed services
1. Open EC2, by searching it or Select Services > Compute > EC2,Click on Key Pairs at bottom
left sidebar
3. Enter Name, Key pair type as RSA and Private key format as .pem, Next click on Create key
pair
10
Deploying the Simple multi tier web application on AWS using managed services
2. Here, we need to enable Internal traffic between the backend services - Active MQ, Elasticache
and RDS, For this we are creating a security group
Note : By default, we don’t have any option to allow internal traffic between multiple services within
security
We can allow traffic by adding IP’s of services at security group, but now we are not created
services, so we following a way
● Creating a dummy Inbound rule and saving it
● Editing the security group inbound rules adding inbound rule with the same security group
and deleting the previous dummy rule
3. Click on Create security group, Then you can see this page
11
Deploying the Simple multi tier web application on AWS using managed services
Click on Create security group at bottom, then security group created, shows the details page
12
Deploying the Simple multi tier web application on AWS using managed services
13
Deploying the Simple multi tier web application on AWS using managed services
4 Creating RDS
1. Open RDS by searching or Select AWS > Services > Database > RDS
2. Before creating the RDS Database, we have to create Subnet groups , Parameter groups,
Click on Subnet groups at sidebar
14
Deploying the Simple multi tier web application on AWS using managed services
15
Deploying the Simple multi tier web application on AWS using managed services
16
Deploying the Simple multi tier web application on AWS using managed services
17
Deploying the Simple multi tier web application on AWS using managed services
(ii). Engine options : Engine type : MySQL & Engine Version : MySQL 5.7.34
18
Deploying the Simple multi tier web application on AWS using managed services
(iv). Availability and durability : Options disabled when we select free tier
(v). Settings :
19
Deploying the Simple multi tier web application on AWS using managed services
(vii) Storage :
● Storage type : General Purpose(Gp2)
● Allocated storage : 20 GiB
● Storage autoscaling :
○ Enable storage autoscaling : Untick
(viii). Connectivity :
● Compute resource : Don’t connect to EC2
● Network type : IPv4
● Virtual private cloud (VPC) : Default
● DB subnet group : Choose Previously created security group for RDS
● Public access : Select No
● VPC security group (firewall) : choose existing , and select previously created security
group for backend
● Availability Zone : No preference
● RDS Proxy : Untick
20
Deploying the Simple multi tier web application on AWS using managed services
21
Deploying the Simple multi tier web application on AWS using managed services
5. Estimated monthly costs : shows monthly bill , Next click on create database
It will takes 5-10 mins to create RDS Database, click on View credential details, then copy
credentials & save them in a secured place
22
Deploying the Simple multi tier web application on AWS using managed services
5 Creating Elasticache
5.1 Overview :
Open Elasticache by searching it, below shows the dashboard of Elasticache, Before going to
create ElastiCache Cluster, we have to create
(i). Parameter groups
(ii). Subnet groups
(i) . Overview : Select Parameter groups on sidebar, Next click on Create parameter group
23
Deploying the Simple multi tier web application on AWS using managed services
(ii). Create parameter group : When after you clicking it, you can see the below dashboard, Give
the below settings and click on create
● Name : Memcached-vprofile
● Description : Elasticache-Memcached-vprofile
● Family : Memcached 1.4
Next, click on Create
(i). Click on Subnet groups on Amazon Elasticache Sidebar to open subnet groups service.
Click on Create subnet group
(ii). Create Subnet group : when after clicking it, we can see below dashboard, asks for settings
follow the below settings/details which are required for the vprofile project
24
Deploying the Simple multi tier web application on AWS using managed services
25
Deploying the Simple multi tier web application on AWS using managed services
→ Location
→ Cluster info
→ Cluster settings
→ Associated subnets
26
Deploying the Simple multi tier web application on AWS using managed services
● Cluster settings
○ Engine version : 1.4.34
○ Port : 11211
○ Parameter groups : memcached-vprofile
○ Node type: cache.t2.micro - 0.5 GiB memory
○ Number of nodes : 1
27
Deploying the Simple multi tier web application on AWS using managed services
28
Deploying the Simple multi tier web application on AWS using managed services
● Security groups : select the security group previously created for Memcached
● Maintenance window : Tick No preference
Click on Next,
Step - 3 : Review
29
Deploying the Simple multi tier web application on AWS using managed services
30
Deploying the Simple multi tier web application on AWS using managed services
6.1 Overview :
● Amazon MQ is a managed message broker service for Apache ActiveMQ and RabbitMQ
that makes it easy to set up and operate message brokers in the cloud, so you can migrate
your messaging and applications without rewriting code.
● Here we use RabbitMQ service using the Amazon MQ
● We have also Related service Amazon SQS is a fully managed and highly scalable
message queuing service for distributed applications and systems.
31
Deploying the Simple multi tier web application on AWS using managed services
(iv). Step 1 - Select broker engine : Select ActiveMQ, Then after click on Next
32
Deploying the Simple multi tier web application on AWS using managed services
● Additional settings :
○ Broker engine version : 5.15.12
○ Broker configuration : Create a new configuration with default values
○ CloudWatch Logs : Tick none of them
○ Network and security : Select Private access
○ VPC and subnets : Use the default VPC and subnet(s)
○ Security group(s) : use previously created backend security group
○ Encryption : AWS owned CMK
○ Maintenance : Untick Enable automatic minor version upgrades
○ Maintenance window : No preference
33
Deploying the Simple multi tier web application on AWS using managed services
34
Deploying the Simple multi tier web application on AWS using managed services
7 Database Initialization
7.1 Overview :
● To connect to RDS Mysql we need a VM with mysql-client installed,
● Need to connect to mysql using RDS endpoint , username and password
● Create accounts database
● Download the database from the git by cloning
● Restore/copy the database to accounts database
● Verify the accounts database has tables related vprofile project
35
Deploying the Simple multi tier web application on AWS using managed services
36
Deploying the Simple multi tier web application on AWS using managed services
(ix) Go to instances select the created instance and connect it with pem key using SSH terminal
→ Copy the Connect string
(x) Open your ssh terminal/Terminal in windows, move to the pem key downloaded directory, in my
case, I have downloaded to Downloads folder, moving to directory and pasting the string in
terminal to connect with vm instance
37
Deploying the Simple multi tier web application on AWS using managed services
(xiii) Enable the MySql Port 3306 of RDS Mysql security group
Now onwards RDS Mysql takes inputs from mysql-client ubuntu VM with 3306 Port
38
Deploying the Simple multi tier web application on AWS using managed services
show databases;
(xvii) exit from mysql and Download the git repo which contain database schema
cd /home/ubuntu/vprofile-project/src/main/resources/
39
Deploying the Simple multi tier web application on AWS using managed services
Use accounts;
Show tables;
40
Deploying the Simple multi tier web application on AWS using managed services
8.1 Overview :
Elastic Beanstalk is a service for deploying and scaling web applications and services. Upload
your code and Elastic Beanstalk automatically handles the deployment—from capacity
provisioning, load balancing, and auto scaling to application health monitoring.
Amazon Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications
and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar
servers such as Apache, Nginx, Passenger, and IIS.
In this Project we are using Elastic Beanstalk for apache tomcat with Auto scaling
41
Deploying the Simple multi tier web application on AWS using managed services
Step - 5 : Enter Platform as Tomcat with Tomcat 8.5 corretto - Amazon Linux 2
And
Step -6 : Application code : sample code & click on Configure more options
Step - 7 :
We have to configure more options for some particular
(i) Instance
(ii) Capacity block
(iii) Load balancer
(iv) Rolling updates and deployments
(v) Security
(vi) Monitoring
(vii) Tags
(viii) Managed Updates
42
Deploying the Simple multi tier web application on AWS using managed services
43
Deploying the Simple multi tier web application on AWS using managed services
Step - 11 : set Autoscaling group environment type as Load balanced , min 2, max 4 instance &
instance type t2.micro , keep everything else as default values
44
Deploying the Simple multi tier web application on AWS using managed services
Step - 13 : Check Application Load balancer with Dedicated or not, no changes right now ,
changes taken place once after Beans launched
45
Deploying the Simple multi tier web application on AWS using managed services
46
Deploying the Simple multi tier web application on AWS using managed services
Step 17 : Add Key pair with Elastic Beanstalk key (previously created)
47
Deploying the Simple multi tier web application on AWS using managed services
48
Deploying the Simple multi tier web application on AWS using managed services
Once After Creation , you can see the Environment Health ok (to see select the created
environment from the sidebar), we can see this only once after Creating the Beanstalk application
and click on the link
49
Deploying the Simple multi tier web application on AWS using managed services
9 Update the security group of backend to allow traffic from Beanstalk Security group
9.1 Overview :
● We have the Beanstalk Application is up and running but we need vprofile project need to
uploaded to Tomcat
● we have to establish the connections between the Tomcat & Backend services Mysql,
Active MQ and ElastiCache Services
● For this , we have to Add Inbound Rules at Backend Security Group as
To check the security groups , go to aws > Services > Compute > EC2 > Sidebar > Select security
group
Here below we can see two new security groups created
(i) One for Elastic beanstalk
(ii) second for Load balancer
For identification purpose renaming with extension tags, you can see the changes
50
Deploying the Simple multi tier web application on AWS using managed services
To Add the Inbound Rules at Backend Security Group, select backend sg and click at
Edit inbound rules
51
Deploying the Simple multi tier web application on AWS using managed services
10.1 Overview :
To build the artefact we need to install the following tools/services in local machine(windows) :
● Chocolatey install
● Installing git
● Installing jdk8
● Install maven
● Clone the git repository
● Build the source code using maven
1. Open power with Run as Administrator : Press windows button > search for windows powershell
> Select Run as Administrator
52
Deploying the Simple multi tier web application on AWS using managed services
53
Deploying the Simple multi tier web application on AWS using managed services
cd F:/
git clone https://github.com/SagarFive/vprofile-project.git
cd vprofile-project
10.Checkout to aws-Refactor branch
54
Deploying the Simple multi tier web application on AWS using managed services
ls
cd .\src\main\resources\
13. We have to update AmazonMQ, AmazonCache and RDS info in the application.properties file,
so now it’s time to grab the information from the services
We have to update the endpoints of services in application.properties file, for that open services
dashboard and copy the endpoints
55
Deploying the Simple multi tier web application on AWS using managed services
Mysql endpoint : Open RDS and select the Database and copy the endpoint
56
Deploying the Simple multi tier web application on AWS using managed services
database-vprofile.ciix4w7yixwy.us-east-1.rds.amazonaws.com
admin
ittdrUcEEiq8fOcHjlPJ
---
ActiveMQ
b-ab9a56fb-e5ce-4864-a0d4-30cf7dd360d7-1.mq.us-east-1.amazonaws.com:5671
rabbit
Ribbon@2023#
----
Memcache
memcached-vprofile-cluster.bzrpsb.0001.use1.cache.amazonaws.com:11211
vim application.properties
57
Deploying the Simple multi tier web application on AWS using managed services
To Save Press ESC to enter in Command mode and Then Enter wq! , once after changes done
5. Building artifact : Go to source code at ec2 > get inside vprofile-project folder (this folder
contains file pom.xml/Move to project directory where pom file is available )
Run the below command to get/build artifact war file
cd <vprofile-project-home-directory>
mvn install
In above screenshot, we can find artefact location ( 5th line from bottom of screenshot) - Copy the
Path
58
Deploying the Simple multi tier web application on AWS using managed services
2. Upload the artefact by clicking upload button ( add version label, choose file - add by using
previously copied path)
59
Deploying the Simple multi tier web application on AWS using managed services
3. Deploy the artifact/application, select the newly uploaded artifact/application > actions > Deploy
60
Deploying the Simple multi tier web application on AWS using managed services
2. Add Health check as /login , for this Beanstalk > Application > Configuration > Processes >
Health check and path as /login
61
Deploying the Simple multi tier web application on AWS using managed services
Save it
62
Deploying the Simple multi tier web application on AWS using managed services
1. Go Beanstalk app and copy the Endpoint of beanstalk application below the application name
2. Run/open the endpoint at web browser, login with username password , both use : admin_vp
63
Deploying the Simple multi tier web application on AWS using managed services
14 Credits
4 Project -
🌐 Copy of Deploying the Simple multi tier application on AWS using Managed…
Thank you !
For more visit us : www.sagar5.in
64