Can I include a test event in a SAM template that is deployed to the lambda web console?

Viewed 126

I know I can invoke lambdas with sam local and also the command line.

But sometimes it's convenient to test the lambda by invoking it through the UI by configuring a test event there.

Is it possible to include sample/test event in the sam template so when its deployed the test event is populated in the UI for me? So I can keep that test event updated and just have to press the test button if I'm working with it through the ui?

1 Answers

Others are wanting the same thing , but when the same question was asked in a github issue on the SAM repo in 2018, Configuring test events through SAM template, AWS engineers said it's not in scope for SAM.

FWIW the answer suggested CodePipeline as a possible way to do something similar, programmatically:

I think this is out of scope of what SAM can do. SAM can't set up a console test event, like Brett mentioned, but something similar to this could be set up in a CodePipeline workflow. For more information about CodePipeline, see the docs:
https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html

Related