AWS Lambda Basics — Writing Serverless Code

Jawadhasan
5 min readApr 9, 2022
Photo by Michael Dziedzic on Unsplash

Introduction

There are four key capabilities for a service or platform to be serverless:

  • No server management.
  • Flexible Scaling.
  • High availability (fault tolerence)
  • No idle capacity

In this post, we will learn the basics of AWS Lambda and how you can use it for different use cases with ease. This will be an introduction post, and shall provide a foundation for upcoming demos and posts for AWS learning.

AWS Lambda is the compute layer where your code is executed.

Lambda is based on functions:

  • Function as a service (FAAS) Offering.
  • Each function contains the code you want to execute, Configurations how to execute, Event-Source (optional) which can detect events and call your functions.
  • Lambda is always ON and ready to receive calls, automatically scales (run multiple copies of the function in parallel, based on demand).
  • Lambda is also stateless
  • Lambda is billing in 100ms increments.
  • Choose Memory, get CPU. (CPU and network capacity increases as allocate more memory).
  • You shall test and measure memory settings to optimize execution cost.

Beware of code-size and other limitations, more info on this link.

You can visit AWS Official Lambda Page for more information and updates.

Workloads you can consider for Lambda

Following are few workload types you can consider lambda:

  • Backend processing.
  • Event processing.
  • Stream processing.
  • Data processing.

Things that can trigger Lambda Functions

  • AWS resource triggers (DynamoDB ops, S3 events, Message Queue Ops etc.)
  • AWS endpoints (REST calls).

Why Lambda

  • Simply execute code.
  • Automatic scaling.
  • Fault tolerant.

--

--

Jawadhasan

Software Solutions Team Lead | Cloud Architect | Solutions Architect