What is AWS lambda function ??

What is AWS lambda function ??

AWS Lambda is a serverless compute service provided by Amazon Web Services (AWS) that allows you to run your code in response to events and automatically manages the underlying compute resources for you. With AWS Lambda, you can run your code in a highly scalable and cost-effective way, without worrying about server management, scaling, or availability.

When you create a Lambda function, you upload your code and configure the function to be triggered by an event, such as changes to data in an Amazon S3 bucket, updates to a DynamoDB table, or messages arriving in an Amazon SNS topic. When the event occurs, AWS Lambda automatically runs your code and provisions the necessary compute resources to handle the event. After the function completes, AWS Lambda releases the resources and reports the results.

AWS Lambda supports several programming languages, including Python, Node.js, Java, Go, Ruby, and .NET. You can also use AWS Lambda to build and deploy serverless applications and APIs using services like Amazon API Gateway, AWS Step Functions, and AWS AppSync.


Here's how AWS Lambda works:

  1. Create a function: You start by creating a Lambda function and uploading your code to the AWS Lambda console or using an integrated development environment (IDE) such as AWS Cloud9. You can write your code in any of the supported programming languages like Python, Node.js, Java, Go, Ruby, and .NET.
  2. Define triggers: You define the triggers that will activate your function. Triggers can be various events such as an object being uploaded to an Amazon S3 bucket, a record being inserted or modified in an Amazon DynamoDB table, or a message being published to an Amazon SNS topic. Lambda functions can also be triggered by other AWS services like AWS Step Functions or Amazon API Gateway.
  3. Process the event: When a trigger event occurs, AWS Lambda receives the event and passes it to your function. The function processes the event and generates a response.
  4. Scale automatically: AWS Lambda automatically scales your function horizontally by creating more instances of your function to handle a larger number of requests. It also scales vertically by increasing the amount of CPU and memory allocated to your function based on the demand.
  5. Pay per use: With AWS Lambda, you only pay for the compute time used to run your function. AWS charges you based on the number of requests, the duration of each request, and the memory allocated to the function.
  6. Monitor and troubleshoot: You can monitor and troubleshoot your function using AWS CloudWatch, which provides metrics and logs to help you identify and diagnose issues.

Overall, AWS Lambda is a powerful and flexible service that allows you to build highly scalable and cost-effective applications without worrying about the underlying infrastructure.


There are several important parts of an AWS Lambda function that you should be aware of:

  1. Handler function: The handler function is the entry point for your code and is called by the Lambda service when your function is invoked. It takes two parameters: an event object and a context object. The event object contains information about the event that triggered the function, and the context object provides information about the runtime environment.
  2. Runtime: The runtime is the environment in which your code executes. AWS Lambda supports several runtimes, including Node.js, Python, Java, Go, Ruby, and .NET. When you create a function, you must specify the runtime for your code.
  3. Permissions: AWS Lambda functions run in a secure environment and require permissions to access other AWS resources. You can grant permissions to your function by creating an execution role, which defines what resources your function can access.
  4. Triggers: Triggers are events that activate your function. AWS Lambda supports several triggers, including changes to data in an Amazon S3 bucket, updates to a DynamoDB table, or messages arriving in an Amazon SNS topic. When a trigger event occurs, AWS Lambda automatically invokes your function.
  5. Environment variables: Environment variables are key-value pairs that you can configure for your Lambda function. They can be used to store configuration settings, API keys, or other sensitive information.
  6. Logging and monitoring: AWS Lambda integrates with AWS CloudWatch to provide logging and monitoring for your functions. You can use CloudWatch to monitor function metrics, view logs, and set alarms for specific events.

Overall, understanding these important parts of an AWS Lambda function is essential for building reliable and scalable serverless applications.

要查看或添加评论,请登录

Harish Sharma的更多文章

  • The migration strategies in AWS “The 7 R’s”.

    The migration strategies in AWS “The 7 R’s”.

    A migration strategy is an approach used to migrate a workload into the AWS Cloud. There are seven migration strategies…

  • 10 most useful commands in Docker!!

    10 most useful commands in Docker!!

    Here are 10 most useful Docker commands: docker run: This command is used to create a new container from a Docker…

  • 10 most useful commands in Linux !!

    10 most useful commands in Linux !!

    cd - This command is used to change the current directory in the Linux terminal. For example, "cd Documents" will…

社区洞察

其他会员也浏览了