Creating a lambda function which runs C# code


Go to your Amazon console and then choose Lambda.

Next, click on Blank Function.




Click next, when you are given the following screen :-



Next, you need to configure the handler. Handler always start off with your assembly (ONLY DLL please, exe is not supported). More detail info, please have a look at diagram below.

Set the runtime to C#.





If you encounter this error,

{
  "errorType": "LambdaException",
  "errorMessage": "Could not find the LambdaSerializerAttribute on the assembly 'TestApp, Culture=neutral, PublicKeyToken=null' or method 'Main' while attempting to deserialize input data of type 'System.String[]'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute."
}


it probably means you are passing a argument in your aws lambda function. It should not take in any arguments unless those type supported by AWS.

For example, if you're passing in

  static void Main(string[] args) // <-- aws="" doesn="" good="" it.="" lambda="" like="" no="" p="" t="">  {

            Console.WriteLine("Testing testing");
            Console.WriteLine("Testing testing");
            Console.WriteLine("Testing testing");
   }


Which you need to change it to :

static void Main()
  {
            Console.WriteLine("Testing testing");
            Console.WriteLine("Testing testing");
            Console.WriteLine("Testing testing");
   }


<-- aws="" doesn="" good="" it.="" lambda="" like="" no="" p="" t="">
<-- aws="" doesn="" good="" it.="" lambda="" like="" no="" p="" t="">That's easy. :)







Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm