Amazon Web Services Lambda

  1. Home
  2. Amazon Web Services Lambda

Introduction to AWS Lambda

AWS Lambda can be defined as a serverless compute service that runs the code in response to events. AWS Lambda manages the underlying compute resources with no server configuration such that re-visioning or managing of servers is not required. AWS Lambda Function also referred as Execution of code that can be triggered by events internal to your AWS infrastructure or external to it.

Implementation of AWS Lambda

Following are the steps involved in the process of implementing AWS Lambda

  1. Configure an AWS Lambda function.
  2. Create a deployment package.
  3. Upload the deployment package.
  4. Create an invocation type.

Some of the popular languages available to write the code are – Node.js, Java, Python, and C#. Such that the language that is selected also controls the tools that are available for authoring the code. These tools can include the AWS Lambda console, Visual Studio, .NET Core, Eclipse, or your own authoring environment. You use these languages to create a deployment package. Code written is part of what we refer as AWS Lambda function. Some other elements of an AWS Lambda function are –

  • Memory
  • Maximum execution time
  • IAM role
  • Handler name

here, the amount of memory being specified controls the CPU power. The default amount of memory allocated per AWS Lambda function is 512 MB, but this can range from 128 MB to 1,536 MB in 64 MB increments.

Invoking AWS Lambda Functions

All the AWS Lambda functions can be invoked either synchronously or asynchronously. When we use AWS Cloud services to invoke AWS Lambda functions, then those AWS Cloud services control whether the function is invoked synchronously or asynchronously. Some of the most prominent ways to invoke AWS Lambda function are –

  • Push event model: In Push event model there are some event sources that can publish events to AWS Lambda and directly invoke AWS Lambda function.
  • Pull event model: In Pull event model there are some event sources publish events, but AWS Lambda must poll the event source and invoke AWS Lambda function when events occur. The Pull event model applies when AWS Lambda is used with streaming event sources such as Amazon Kinesis and Amazon DynamoDB Streams.
  • Direct invocation model: Direct invocation model type causes AWS Lambda to execute the function synchronously and returns the response immediately to the calling application. Such that this invocation type is available for custom applications.

AWS Lamda Management

We can test AWS Lambda function either in the AWS Lambda console or by using the CLI such that Amazon CloudWatch provides metrics for AWS Lambda. Some of the following are included in metrics, but are not limited to, the following options-

  • Invocation count
  • Invocation duration
  • Number of requests
  • Latency per request
  • Duration of code execution

AWS CloudTrail records the API calls used for the AWS Lambda functions which provides another source of information for troubleshooting.

AWS Lambda Security

Amazon Linux AMI is the underlying compute infrastructure for AWS Lambda. Since AWS is responsible for maintaining this infrastructure (in terms of patching and upgrading), therefore we are not able to log in to these compute instances or customize the operating system or language run times. We can also also manage permissions using an AWS Lambda function policy which allows us to have an event to invoke an AWS Lambda function.

Menu