Autoscaling group kept creating instances in loop

Hello again @surajthakur!

I’ve been doing a pretty intense dive on this one and was able to reproduce the problem you are having here.

I took a look at the logs (you can find your own by going to the location pointed to at the bottom of this page) given from the elastic stack for the instance being used in my test setup and found the following lines:

2023-05-18T13:02:55.389-04:00	export NVM_DIR="$HOME/.nvm"
	2023-05-18T13:02:55.389-04:00	[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
	2023-05-18T13:02:55.389-04:00	bash: line 13: HOME: unbound variable

So it appears the script is failing due to the $HOME variable missing while the script is running. Since this script is running as root, you could likely just replace $HOME with /root/. But that’s where your problems are likely since that’s where it’s having issues with my test setup.