Reputation: 21
I have an AWS Lambda function (API) that returns a result based on some parameters. I want to pass the parameters from my C# controller and consume the returned result as well. How can I call my Lambda API from the C# controller?
Upvotes: 2
Views: 2641
Reputation: 2804
somethings like this:
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);
Upvotes: 1