Intro
Recently I made a blog post regarding migration of PostgresDB to Amazon RDS. This was in fact something I had to do during a personal AWS project that utilised postgresDB. In this article I will try to go over the entire project in more detail.
The project is a simple online node web app that showcases cars for a car dealership and it’s written in node js. It uses technologies such as EC2, RDS and Route53.
The front end is bootstrap and Jquery.
Design
The design is simple but follows the core three tiered approach and uses availability zones for HA. In this scenario the whole set up resides in one region but in production environments we could add more regions for resilience.

In the public tier the load balancer resides which distributes traffic evenly between the two virtual machines in two availability zones. The virtual machines can of course be containerized and replaced with Amazon ECS.
Implementation
The ALB is assigned the two public subnets that have routes to the internet via the internet gateway.

The ALB will have the two EC2 instances as targets.

Project files can be found on my github. I used WinSCP to transfer the files to the /var/www folder on one of the EC2 instances, then crated a custom AMI from it to create the second EC2 instace.
To complete the file transfer we need to ensure the ec2-user account has sufficient privileges on the directory. To do so we can assign ownership to the directory and all it’s sub-directories.

Once the permission is assigned we can use WinSCP to transfer files.

To save on AWS network transfer costs we can exclude npm modules from the transfer and run the npm install locally on the EC2 instance which would install them all.
Optional Docker containerization
As stated earlier, the project can be containerized and deployed to AWS ECS or an EKS cluster. The pipeline yaml file constsits of multiple stages of build, TrivyScan and push to docker hub.
I have also added a test last step to deploy the image to Azure AKS.

Final Words
I cannot possibly touch on all elements of this project without making this a very long winded blog post. However I tried to cover the important aspects.
Any questions feel free to get in touch via email or comment below.
You must be logged in to post a comment.