AWS Lambda is a compute service that lets you run your code in response to events without the need to provision or manage servers. It automatically scales the server based on the incoming traffic.
Event Based : AWS Lambda is event driven. It means lambda function can be triggered by certain events like file uploaded to S3 or specific time.
Automatic Scaling : AWS Lambda scales the website depending on the traffic.
Function Code : This is the place where the code is written or uploaded as zip. Zip can be uploaded to S3 and can be called from lambda.
Go to AWS lambda -> create function
Provide function name and choose the runtime
There are three ways to create function for lambda.
From Scratch - Using this, we can write code in aws editor itself.
Blueprint - It has some predefined codes already written.
Container Image - We can use container from AWS Elastic Container Registry(ECR).
Enable function URL in advanced settings.
Function URL - It provides a url which helps us to access the lambda through browser.
Choose VPC and tags if needed.
Lambda is created and it contains the default code.
Create a test event to run our lambda function and select test.
Output from lambda looks like this,
We can use the function URL to access the Lambda function in browser.
We can upload zip code or using S3 bucket.
Event Bridge - Amazon EventBridge is a serverless event bus that ingests data from your own apps, SaaS apps, and AWS services and routes that data to targets.
Example - If your application wants to trigger lambda function whenever a object is uploaded to lambda, Event Bridge can be used to achieve this.
SQS - Simple Queue Service allows you to send, store, and receive messages between software components at any volume, without losing messages.