There are two types of invocation for Lambda:

  • Request/Response
  • Asynchronous invoaction

 

Demo by using AWS CLI:

Request/Response

aws lambda invoke --function-name hello-world \
--invocation-type RequestResponse \
--log-type Tail --payload '{"name": "AWSLambda"}' \
result.txt

It will also output a file called result.txt to save the response.

[AWS] Lambda Invocation types

 

Asynchronous Invocation

aws lambda invoke --function-name hello-world \
--invocation-type Event \
--log-type Tail --payload '{"name": "AWS Lambda"}' \
result.txt

Becasue it is asyn, it won't output the response.

[AWS] Lambda Invocation types

 

Error Handling

[AWS] Lambda Invocation types

相关文章: