AWS - Lambda Function

 

This is a two-part series. In this first post, we will see how to create a lambda function and the type of lambda function.

Steps to create lambda function on AWS UI. One of the prerequisites is to create a role that as Lambda execution permission.




Now we have a role created.


Let's proceed with the function creation.








Let's test the code by creating an event.



Lambda function can be invoked ASYNC or SYNC.

From UI, ASYNC is the default setting.

Executing the lambda via SYCN/ASYCN can be triggered via CLI.

SYNC: When a lambda is invoked via SYNC it sends the response to the calling function once the lambda execution is completed.

ASYNC: When a lambda is invoked via ASYNC it sends an empty response with response code 202. As ASYNC places the lambda into an event queue and executes ASYNC-ly.

> aws lambda invoke --function-name <lambda-name> --invocation-type RequestResponse/Event 
--cli-binary-format raw-in-base64-out --payload <JSON> response.json

--invocation-type:  RequestResponse[SYNC Invocation] /Event [ASYNC Invocation]

We are done with Lambda. The next part will integrate API GW with the Lambda function.



Comments

Popular posts from this blog

K8s - ETCD

SRE/DevOps Syllabus

K8s - Deployment and HPA replicas