Created
June 22, 2022 00:54
-
-
Save ljchuello/cb7d37833dc5a6cb0765824a4c417ce4 to your computer and use it in GitHub Desktop.
Ejecuta una función de AWS Lambda desde C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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