简体   繁体   English

AWS lambda 函数 - 如何让 R 脚本从 node.js lambda 函数运行?

[英]AWS lambda function -how to get R script to run from node.js lambda function?

I have an already existing AWS lambda function whose trigger event is any updates to a particular S3 bucket.我有一个现有的AWS lambda 函数,其触发事件是对特定 S3 存储桶的任何更新。 I need to run this S3 input through some R scripts .我需要通过一些R 脚本运行这个 S3 输入。 The runtime is node.js and other events depend on this being a node.js configuration.运行时是 node.js,其他事件取决于这是一个 node.js 配置。 The scripts I need to run must be in R because other languages aren't suitable.我需要运行的脚本必须是 R 语言,因为其他语言不适合。

How to I get the R scripts to run from this node.js lambda function?如何让 R 脚本从此 node.js lambda 函数运行?

  • Event type: All object create events事件类型:所有对象创建事件
  • Runtime: Node.js 14.x运行时:Node.js 14.x

If you want to try and run two languages in the same lambda your only choice is to deploy a custom Docker image for the lambda container with both the languages installed.如果您想尝试在同一个 lambda 中运行两种语言,您唯一的选择是为安装了这两种语言的 lambda 容器部署自定义 Docker 映像。

However.然而。 Its not like there is a command line for you to access, so unless you code your nodejs lambda to call the R script and wait for its response(which is technically possible) you wont be able to just call it.它不像有一个命令行供您访问,因此除非您编写 nodejs lambda 以调用 R 脚本并等待其响应(这在技术上是可能的),否则您将无法调用它。

You are probably better off deploying a second lambda with a custom docker that just has R on it (as R is not a language lambda supports yet) and call that lambda using the SDK and wait for its response.您可能最好使用仅包含 R 的自定义 docker 部署第二个 lambda(因为 R 还不是 lambda 支持的语言)并使用 SDK 调用该 lambda 并等待其响应。

Though, there isthis article that indicates there is a lambda layer that may give you R access - you should check that out不过,有这篇文章表明有一个 lambda 层可以为您提供 R 访问权限-您应该检查一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM