Skip to content

Instantly share code, notes, and snippets.

@ljchuello
Created June 22, 2022 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljchuello/cb7d37833dc5a6cb0765824a4c417ce4 to your computer and use it in GitHub Desktop.
Save ljchuello/cb7d37833dc5a6cb0765824a4c417ce4 to your computer and use it in GitHub Desktop.
Ejecuta una función de AWS Lambda desde C#
// Parametro
string parametro = "ljchuello";
// CLiente
AmazonLambdaClient lambdaClient = new AmazonLambdaClient("AccesKey", "SecretKey", RegionEndpoint.USEast1);
// Contecto
InvokeRequest invokeRequest = new InvokeRequest
{
FunctionName = "Test_Lambda",
InvocationType = InvocationType.RequestResponse,
Payload = JsonConvert.SerializeObject(parametro)
};
// Llamada
InvokeResponse invokeResponse = await lambdaClient.InvokeAsync(invokeRequest);
// Resultado
string content;
using (StreamReader reader = new StreamReader(invokeResponse.Payload))
{
content = await reader.ReadToEndAsync();
}
Console.WriteLine(content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment