我有一个AWS Lambda函数(API),它根据一些参数返回结果。我想从我的C#控制器传递参数并使用返回的结果。如何从C#控制器调用我的Lambda API?
答案 0 :(得分:1)
AmazonLambdaClient alc = new AmazonLambdaClient(AWSAccessKey, AWSSecretKey, RegionEndpoint.USEast1);
Amazon.Lambda.Model.InvokeRequest ir = new Amazon.Lambda.Model.InvokeRequest();
ir.FunctionName = "arn:YOUR_FUNCTIONS_ARN";
ir.Payload = SOME_JSON_ARGUMENTS;
var res = alc.Invoke(ir);
var yourResult = DESERIALIZE_SOMEHOW(res.Payload);