aws step函数将数据从lambda传递到lambda

时间:2020-07-27 20:47:36

标签: amazon-web-services aws-lambda aws-step-functions

我一直在研究如何在Step Function中将数据从Lambda传递到另一个Lambda,这就是我得到的。 我有一个通过数据名称的虚拟lambda:

exports.lambdaHandler = async (event, context, callback) => {
    const name = 'test';
    callback(null, { name });
}

到另一个lambda,我尝试以这种方式获取数据,但是不起作用:

const name = event.name; //this returns undefined

基于on this tutorial,这应该足够了,但是不起作用。你能指出我应该朝哪个方向走吗?我必须使用状态机的InputPathResultPath属性吗?

[更新] 这是状态机的定义:

{
  "Comment": "commen test",
  "StartAt": "FunctionOne",
  "States": {
    "FunctionOne": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": <arn FunctionOne>
      },
      "Next": "FunctionTwo"
    },
    "FunctionTwo": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": <arn FunctionTwo>
      },
      "End": true
    }
  }
}

1 个答案:

答案 0 :(得分:1)

尝试一下

library(rworldmap)
library(ggplot2)
library(scatterpie)

WorldData <- map_data('world') 
toPlot <- data.frame(long = 0, lat = 0, r = 20, A = 5, B = 2, C = 10 )

dev.new();
ggplot( ) + 
  geom_polygon( data =  map_data('world') , aes(long, lat, group = group),
                fill = 'black', colour = 'grey', size=0.5 ) + 
  coord_fixed(1.3) + 
  
  geom_scatterpie(aes(x=long, y=lat, r=r ), 
                data = toPlot , cols=c("A", "B", "C"),
                color=NA, alpha=1, n = 1000 , linetype = 2 ) +
  theme(legend.position = 'none')