Search code examples
pythonaws-lambdaeventtrigger

Trigger AWS lambda function using input parameter from json file uploaded to S3


I am trying to upload the next json file to S3:

{"Project":"Project1", "Number_test_case":{ "Test1":"Yes","Test2":"No","Test3":"Yes"}, "Execution_time":"date_time"}

Normally, the date_time is going to have the next format :28022022_1100 means 28/02/2022 at 11 am I want to use this parameter to trigger a Lambda function is it possible via creating a rule ? or shall I modify the event paramter that I pass to my lambda handler ?


Solution

  • I want to use this parameter to trigger a Lambda function

    That's not possible. S3 will always trigger the Lambda function immediately, as soon as the object is created in S3. You can't use the contents of the object to control that in any way. There is also no built-in way to delay the triggering of the Lambda function. You would have to write something, like another Lambda function, that takes the initial S3 object, reads the contents, and then perhaps creates an scheduled event to trigger the other Lambda function at the given time.