如何在 dotnet core lambda 中从 AWS 事件桥接收事件?

Fre*_*son 3 amazon-web-services .net-core serverless-framework

我无法找到如何使用 dotnet core(最好是 3.1)从 AWS 事件桥接收事件的示例。谢谢

小智 9

Include in your project the package Amazon.Lambda.CloudWatchEvents and wrap your event with CloudWatchEvent<T>

 public void EventBridgeTriggerHandler(CloudWatchEvent<object> input, ILambdaContext context)
 {
    var payloadModel = JsonConvert.SerializeObject(input);
    Console.WriteLine($"Input:..{payloadModel}");
 }
Run Code Online (Sandbox Code Playgroud)

object can be substituted with your event class.