title: AWS EC2 Launch configuration user data - command not found
body: <p>For AWS EC2 (Amazon Linux) launch configuration, I have set some userdata having some sequence of commands which looks like below. </p>
  
  <pre><code>#!/bin/bash -exv \n", 
  "#Execute Init resource\n", 
  "whoami\n", 
  "pwd\n", 
  "npm -v\n",
  </code></pre>
  
  <p>Upon instance startup, user data is executing fine and native commands like "whoami" are giving correct output in cloud-init-output.log but it is giving error for npm command with error message like "npm command not found".</p>
  
  <p>But, when I ssh to the instance and try executing some npm commands, it is working fine.</p>
  
  <p>Could some one please guide me in solving this?</p>
  
  <p>Thanks</p>