Reputation: 3355
I have created a Lambda and uploaded Python scripts along with the dependencies, I scheduled the Lambda to be executed three times a day, but I wanted to test it manually first so that I can have a look at the logs in CloudWatch, how can I do this?
I noticed that there is a 'Test' section but how can I configure this to tell Lambda to execute my script instead of using this 'hello world' test template, many thanks.
Upvotes: 0
Views: 1507
Reputation: 269340
Typically, an AWS Lambda function is triggered by an event, such as an object being uploaded to Amazon S3 or a message being sent to an Amazon SQS queue.
In such situations, data about the event that triggered the function is supplied in the event
variable passed to the function.
To simulate such events for testing purposes, the AWS Lambda console has the ability to provide a JSON event that mimics such events.
However, if your Lambda function does not require any input data via the event
variable, then you can simply:
This will execute the Lambda function within the console and will immediately provide any error messages and/or display any information that is printed by your function. It is a great way to debug Lambda functions!
Upvotes: 2
Reputation: 3207
It is simple, just edit the example json with your expected one.
Put a name of your testing event and click Create
, after that you will have it saved in the dropdown on the left side of the Test
button.
It is described also over here - https://docs.aws.amazon.com/lambda/latest/dg/getting-started-create-function.html#get-started-invoke-manually
Upvotes: 1