How to Create Simple Lambda Function in AWS

Here’s how to create a lambda function in AWS. The lambda service supports Java, Node.js, C#, Python, and Go languages.

Once you create, the next step is to implement it. Upload your code, and configure the execution environment. Then, the code executes within a fully managed computing environment.

AWS Lambda

The features of lambda.

  • Offers a maintenance-free and highly available computing environment.
  • You no longer need to install security updates, replace failed virtual machines, or manage remote access (such as SSH or RDP) for administrators.
  • It is billed by invocation. Therefore, you don’t have to pay for idling resources that are waiting for work (for example, for a task triggered once a day).

Lambda is Serverless

  • It is a Serverless, event-driven computing service.
  • Maintenance is not needed. So it is called serverless. No need to manage and maintain virtual machines.
  • Fully managed service offering scalability and high availability.
  • Billed per request and by resource consumption. Invoke the function to execute your code in the cloud.

Lambda Vs EC2

Here are the differences between EC2 and Lambda

  • Virtual machines provide a full operating system for running one or multiple applications. In contrast, AWS Lambda offers an execution environment for a single function, a small part of an application.
  • Amazon EC2 offers VMs as a service, but you are responsible for operating them in a secure, scalable, and highly available way. By contrast, AWS Lambda offers a fully managed execution environment.
  • AWS Lambda is billed per execution, and not per second a virtual machine is running.

Blueprint in AWS

Blueprints are sample code templates. You can use them for your first lambda function.

Steps to create Lambda function

  1. Visit Blueprints to get the sample code
  2. Search for Lambda==> Function==> Create function
  3. Fill basic details
  4. Create a new IAM role to write your Lambda function details to cloud watch
  5. Create a cloud watch event
  6. Map the rule name in Cloud watch is the same as Lambda function name

That’s it you can watch your lambda function work in Cloud watch. You can try this in AWS console-free account.


Posted in AWS

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.