Our client had their inventory application which processes a lot of database queries on an hourly and daily basis hosted in the AWS cloud on an EC2 instance. As a result of the frequent rate at which data is queried from the database, our client wanted to migrate all their database to Amazon Relational Database Service (RDS).
Our solution was to deploy an architecture that hosts the client`s web application on their EC2 instance but points to AWS RDS MySQL data server.
The Client`s current architecture
Considering the Client`s current architecture, it is a less pragmatic way of implementing a reliable solution to this specific business need; the frequent querying of data in the most economic way.
Why change this current architecture?
- It is self-managed.
- Redundancy is reduced.
- Operational costs are relatively higher.
- Less secure
To satisfy the specific business need, a more appropriate architecture had to be deployed to replace the existing one.
The Ideal Architecture
This architecture deploys the database on a separate instance i.e., and RDS instance. The EC2 instance which hosts the web application server points to the RDS instance as its database. This new architecture is deployed in a VPC with the RDS instance in a private subnet because of security considerations and the EC2 instance hosting the web server in a public subnet making it public facing.
This new architecture equips the client with the following benefits:
- It is highly available and redundant.
- It is AWS managed.
- It is scalable.
- It is cost-efficient.
- It has strong security.
THE SOLUTION STEPS
- Create a subnet group in the VPC of the already existing EC2 instance.
- Create an RDS instance in the specified subnet group.
- Export and clone the web application files from its repository to the web server on the EC2.
- Connect the RDS DB instance to the EC2 instance using the connection string of the DB instance.
- Add the main application file to the root directory of the web server on the EC2 instance.