You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An AWS Lambda function that executes a shell command and returns the output. Additional executable binaries can be deployed with and used by the function.
An AWS Lambda function that executes a shell command and returns the output. Additional executable binaries can be deployed with and used by the function.
1. Prepare
Create a 'bin' subdirectory in the project directory and add any executable binaries your function needs. These binaries must be compatible with the AWS Lambda execution environment, which is Amazon Linux. Make sure they have the execute permission set.
2. Build
Open a shell in the project directory and run npm run dist. If you're on Windows, make sure you use a Linux shell so that file permissions are properly copied into the package. Then deploy the dist/package.zip file to your AWS Lambda function.
3. Invoke
You can quickly test your function from the Lambda console with this simple test event:
{"command": "ls","args": ["-l"]}
Request
The request event can have the following properties:
command: the shell command to execute
args: array of arguments
stdin: a string that is passed as stdin
stdinEncoding: encoding of stdin (default 'utf8', use 'base64' for binary)
stdoutEncoding: encoding to use to encode stdout into a string
Response
The response can have the following properties:
exitCode: either the exit code or the signal that ended the command
stdout: the command's stdout as a string
stderr: the command's stderr as a string
About
An AWS Lambda function that executes a shell command and returns the output. Additional executable binaries can be deployed with and used by the function.