In this series we will talk about the features that come from AWS Lambda. In this first article we will cover one of the feature of Lambda - event-driven workflows.
Before serverless, when the servers wanted to respond to e.i. API call it was necessary that the server was listening on a particular port every minute of a year for a request. Lambda is not doing that.
The new approach that Lambda is bringing is based on event - driven workflow. The Lambda function is invoked by Lambda service when some event happens.
There is a lot of services that Lambda can be awaiting the event from. It could be for example Dynamo DB, Amazon S3 or API gateway. For the specific event for example -> there could be a file upload to Amazon S3 which can trigger the invoke of a Lambda function. It could be also a Dynamo DB table update or API call and many more.
As described above and on the image. Firstly there should be an event source -> which invokes the lambda and then the code within lambda is executed. There is a result from it which can also continue to some of the other AWS services.
Let's describe some use case examples from AWS website.
Website
Let's say there is a calculator for exchange rates. After entering the from, to amount and the currencies we hit Convert button and there is a request made to an endpoint which route the request to Lambda -> then the result is calculated by lambda and give back the result.
There are lot of other services that can be taken as the event source that will invoke the Lambda function. Find more information on AWS website in this article -> Using AWS Lambda with other services
FOLLOW tellitwithcode on Instagram
Sources:
Introduction to AWS Lambda & Serverless Applications
Top comments (0)