EC2 Image Builder Recipe for NodeJS app deployment

0

Hi AWS, is there a way where you spin a plain vanilla server and then you need to install Linux or Windows OS and then you need to clone the application code and store it in some location and further that download the npm package, initialize it, do the build and run the application. It will be exposed to a port as well like 4000. And further you need to run the application as service using pm2.

Is there a way where we can embed this workflow in the recipe and further attach to the EC2 instance with all the packages installed and I want to do this using a CI/CD.

profile picture
Arjun
asked 9 months ago417 views
1 Answer
0

One way to do it is by using AWS CodePipeline that will deploy CloudFormation template with EC2 Image Builder Recipe.

https://aws.amazon.com/codepipeline/

https://aws.amazon.com/cloudformation/

NodeJS example: https://dev.to/aws-builders/deploying-nodejs-application-on-amazon-ec2-using-aws-codepipeline-20i1

profile picture
answered 9 months ago
  • Do you have any example handy for this @myronix88 as I am doing this for the first time.

  • This would all tie into CodeDeploy which will deploy applications to an EC2 automaticlly https://docs.aws.amazon.com/codedeploy/latest/userguide/welcome.html

  • I think I need to rephrase my question:

    Suppose you have an instance which has 10 binaries installed. It is serving some application and your website only has 100 users. With time your application starts gaining popularity and the users are 500 now. In an ideal case we should spin up for more instances but that is not the right approach as we are not going to increase the number of instances. Having said that there is some autoscaling that should be happening and in front of it a load balancer is running which is responsible for managing the traffic. How to make sure when we update the server with more binaries then how the ASG is going to pick that updated image using CI/CD pipeline?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions