Deploy and test your Function

We will do test our lambda function here.

First, click Test button on the left of Deploy.

Select Create new test event. For Event template, choose hello-world. Give a name to your test and write your test case in json format, like the following figure. Then click Create to create your test.

Then click Test again, you will get a file called Execution result, showing the result of your test.

We can also invoke our deployed lambda function through aws cli. Go to the shell we opened before entering into the AWS Console, paste the following command, you will successfully invoke your sum function and get the result.

# The function return will be saved in response.json.
aws lambda invoke --cli-binary-format raw-in-base64-out --function-name sum --payload '{ "a": 2, "b": 3}' response.json && less response.json

Last updated

Was this helpful?