I'm trying to install nvm / node on an AMZ Linux 2 EC2 Instance using the following userData script:
#!/bin/bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 16.17.0
nvm use 16.17.0
However, when I SSH into the Instance, neither nvm nor node are installed. If I run the commands manually while SSH'd into the Instance, they work fine.
Anyone have any thoughts on why the installs don't work in the userData script? Thanks for any thoughts!