Can bash script be written inside a AWS Lambda function

后端 未结 7 1871
北荒
北荒 2020-12-05 09:40

Can I write a bash script inside a Lambda function? I read in the aws docs that it can execute code written in Python, NodeJS and Java 8.

It is mentioned in some doc

7条回答
  •  醉梦人生
    2020-12-05 10:14

    Its possible using the 'child_process' node module.

    const exec = require('child_process').exec;
    
    exec('echo $PWD && ls', (error, stdout, stderr) => {
      if (error) {
        console.log("Error occurs");
        console.error(error);
        return;
      }
      console.log(stdout);
      console.log(stderr);
    });
    

    This will display the current working directory and list the files.

提交回复
热议问题