AWS Lambda

AWS Lambda

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.

  1. Go to AWS lambda -> create function

  2. Provide function name and choose the runtime

    There are three ways to create function for lambda.

    1. From Scratch - Using this, we can write code in aws editor itself.

    2. Blueprint - It has some predefined codes already written.

    3. Container Image - We can use container from AWS Elastic Container Registry(ECR).

  3. Enable function URL in advanced settings.

    Function URL - It provides a url which helps us to access the lambda through browser.

  4. Choose VPC and tags if needed.

  5. Lambda is created and it contains the default code.

  6. Create a test event to run our lambda function and select test.

  7. Output from lambda looks like this,

  8. We can use the function URL to access the Lambda function in browser.

  9. 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.

Did you find this article valuable?

Support Gopinath by becoming a sponsor. Any amount is appreciated!