title: Invoke shell script in AWS Lambda using node.js
body: <p>I am new to AWS Lambda. I am trying to invoke a basic "Hello World" shell script from an AWS Lambda function coded in node.js.</p>
  
  <p>run.js file contains the following:</p>
  
  <hr>
  
  <pre><code>#!/bin/bash
  echo "Hello, World!"  
  </code></pre>
  
  <hr>
  
  <p>I have also coded the function by storign it in an index.js file containing the following:</p>
  
  <hr>
  
  <pre><code>var exec = require('child_process').exec;
  
  exports.handler = function(event, context) {
      exec('./run.sh' , function(error, stdout) {
          context.done(error, stdout);
      });
  };
  </code></pre>
  
  <hr>
  
  <p>I have created a zip file containing both files and have uploaded it to AWS Lambda console by creating a new Lambda function and granting it a lambda_basic_execution role.</p>
  
  <p>I was expecting to be able to see the Hello World, have tried variations of this code but so far have been unable to call a shell script from an AWS Lambda function.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Andy </p>