I have 1 perfect AWS EC2 instance in working condition which is running NODE js which have its elastic IP.
Now I need to auto-scale if that instance in use over 80%.
I do know few ways to do that but am not able to figure out, when new instance launches how will my node code will be on that instance.
Later when I want to update my node code then on which instance should I connect with?
If anyone can help me with this then it would be awesome.
Thanks :)
If you want to use the EC2 AutoScaling, you must know that the instances are in a stateless mode ( can be started/Terminated) by the autoscaling group regarding the metrics and indications of elasticity ( cpu, number of request...) memory is a custom metric
So to use the AutoScaling group, you must generate from your current working machine an AMI ( Amazon Machine Image) that contains the code of your node.js and create a launch configuration/template, for the next machines EC2 can use it to bootstrap.
IF you want to update your code, that means you must update your Launch configuration ( updated AMI, or use the user data bootstrap to get the update node.js from S3 or other location) or use maybe CodeDeploy wich is the perfect candidate for this king of subject.