AWS Lambda: A Serverless Framework

Pratik Gaikwad
6 min readMar 12, 2022
AWS Lambda

Serverless 🤔

No thinking of server, AWS Will manage all the servers for us😱

AWS Lambda is an awesome offering. You provide the code, AWS handles the infrastructure and execution for you.

But where is your code actually executed? How does AWS do it?

I recently tried to explore it out for myself, and this article is the result of what I found.

Let me clear the topics one by one

What is AWS Lambda?

AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS). Users of AWS Lambda create functions, self-contained applications written in one of the supported languages and runtimes, and upload them to AWS Lambda, which executes those functions in an efficient and flexible manner.

The Lambda functions can perform any kind of computing task, from serving web pages and processing streams of data to calling APIs and integrating with other AWS services.

The concept of “serverless” computing refers to not need to maintain your own servers to run these functions. AWS Lambda is a fully managed service that takes care of all the infrastructure for you. And so “serverless” doesn’t mean that there are no servers involved: it just means that the servers, the operating systems, the network layer, and the rest of the infrastructure have already been taken care of so that you can focus on writing application code.

Key Features of AWS Lambda -

Extend other AWS services with custom logic
AWS Lambda allows you to add custom logic to AWS resources such as Amazon S3 buckets and Amazon DynamoDB tables, so you can easily apply to compute to data as it enters or moves through the cloud.

It is easy to get started with AWS Lambda. First, you create your function by uploading your code (or building it right in the Lambda console) and choosing the memory, timeout period, and AWS Identity and Access Management (IAM) role. Then, you specify the AWS resource to trigger the function, which can be a particular Amazon S3 bucket, Amazon DynamoDB table, or Amazon Kinesis stream. When the resource changes, Lambda will run your function, launching and managing the compute resources as needed to keep up with incoming requests.

Build custom backend services
You can use AWS Lambda to create new backend application services triggered on-demand using the Lambda application programming interface (API) or custom API endpoints built using Amazon API Gateway. Lambda processes custom events instead of servicing these on the client, helping you avoid client platform variations, reduce battery drain, and enable easier updates.

Automatic scaling
AWS Lambda invokes your code only when needed, and automatically scales to support the rate of incoming requests without any manual configuration. There is no limit to the number of requests your code can handle. AWS Lambda typically starts running your code within milliseconds of an event. Since Lambda scales automatically, the performance remains consistently high as the event frequency increases. Since your code is stateless, Lambda can start as many instances as needed without lengthy deployment and configuration delays.

Run code in response to Amazon CloudFront requests
With Lambda@Edge, AWS Lambda can run your code across AWS locations globally in response to Amazon CloudFront events, such as content requests to or from origin servers and viewers. This makes it easier to deliver richer, more personalized content to your end-users with lower latency.

Orchestrate multiple functions
Build AWS Step Functions workflows to coordinate multiple AWS Lambda functions for complex or long-running tasks. Step Functions lets you define workflows that trigger a collection of Lambda functions using sequential, parallel, branching, and error-handling steps. With Step Functions and Lambda, you can build stateful, long-running processes for applications and backends.

Integrated security model
AWS Lambda’s built-in software development kit (SDK) integrates with AWS Identity and Access Management (IAM) to ensure secure code access to other AWS services. AWS Lambda runs your code within an Amazon Virtual Private Cloud (VPC) by default. Optionally, you can configure AWS Lambda resource access behind your own VPC in order to leverage custom security groups and network access control lists. This provides secure Lambda function access to your resources within a VPC. AWS Lambda is SOC, HIPAA, PCI, and ISO-compliant. For the latest in Lambda certification and compliance readiness, please see the full services in scope.

Trust and integrity controls
Code Signing for AWS Lambda allows you to verify that only unaltered code published by approved developers is deployed in your Lambda functions. You simply create digitally signed code artifacts and configure your Lambda functions to verify the signatures at deployment. This increases the speed and agility of your application development, even within large teams, while enforcing high-security standards.

Process For Creating AWS Lambda Function

Step 1: Login into your AWS account and click on “Sign in to the Console.”

Step 2: Enter your login ID and password.

Step 3: Select Lambda under "AWS Services"

Step 4: Click on “Create Function”

Step 5: Select options and click on the “Create Function” button

Function Type: Author from scratch

Name: lambdaBlog

Runtime: Node.js 10. x

Role: Choose an existing role / Create any custom rule

Existing Role: lambda_basic_execution

Step 6: Now you will be able to see the below screen. Choose a way to upload/create code in the lambda function.

Step 7: Now you can write your code in the editor provided, it runs on Nodejs which we selected earlier.

Step 8: Handler name should be the same as your function name, this way AWS knows which function to execute.

Step 9: We can add more options like execution timeout, environment variables, tags to group out our other functions, memory, etc.

Step 10: Click "Save."

Step 11: Now copy the ARN number on the top right corner.

Architecture of AWS Lambda -

AWS Lambda for Web Application -

AWS Lambda for StreamProcessing -

This is an incomplete list of resources I’ve used to learn about AWS Lambda. There are not included all links from the blog post text above. The list’s purpose to act as a quick reference.

--

--