Simple Enough Blog logo
  • Home 
  • Projects 
  • Tags 

  •  Language
    • English
    • FranΓ§ais
  1.   Blogs
  1. Home
  2. Blogs
  3. Introduction to AWS Lambda: the complete guide for beginners and developers

Introduction to AWS Lambda: the complete guide for beginners and developers

Posted on May 6, 2026 • 5 min read • 917 words
CICD   Devops   Organisation   Helene  
CICD   Devops   Organisation   Helene  
Share via
Simple Enough Blog
Link copied to clipboard

AWS Lambda is often one of the first services people discover when exploring serverless on AWS. And for good reason: the promise is very appealing.

On this page
I. What is AWS Lambda?   II. How does it work?   1. The trigger   2. The function   3. The execution   III. Architecture diagram   IV. Your first Lambda handler in Go   Prerequisites   Handler structure   Build and deploy   Test the function   V. Real use cases   1. Lightweight REST API   2. File processing on upload   3. Automation and scheduled tasks   4. Message processing   5. Lambda@Edge   VI. Limits you must know   Cold start   Lambda fits when   Not ideal for   VII. Pricing   Conclusion   πŸ”— Useful links  
Introduction to AWS Lambda: the complete guide for beginners and developers
Photo by Helene Hemmerter

I. What is AWS Lambda?  

AWS Lambda is a serverless compute service launched by Amazon in 2014.
The idea is simple: you provide a function (a piece of code), and AWS runs it on demand, without you having to manage any servers.

You don’t provision servers, you don’t maintain an OS, and you don’t configure autoscaling manually.

The word serverless can be confusing β€” there are still servers, of course.
But they are fully managed by AWS. We only see the code.

Lambda supports many languages: Go, Python, Node.js, Java, Ruby, .NET, and even custom runtimes via the Lambda Runtime API.


II. How does it work?  

The Lambda execution model relies on three elements:

1. The trigger  

Lambda does not run continuously. It is triggered by an event.
This event can come from many AWS services:

SourceExample
API GatewayAn HTTP GET /users call
S3A file uploaded to a bucket
SQS / SNSA message sent to a queue
EventBridgeA scheduled event (cron)
DynamoDB StreamsA change in a table
CloudFrontLambda@Edge to modify requests

2. The function  

This is the code.
It receives an event (trigger data) and a context (execution metadata: request ID, remaining timeout, etc.).

3. The execution  

AWS allocates a runtime environment (CPU + RAM), executes the function, then releases the resources.

If multiple requests arrive at the same time, Lambda scales horizontally and creates multiple instances in parallel β€” automatically.


III. Architecture diagram  

Here is a classic architecture example: a serverless REST API with Lambda at the center.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ ┐
β”‚   Client    │──────▢│   API Gateway   │──────▢ β”‚ AWS Lambda    β”‚
β”‚ (navigator  β”‚  HTTPS β”‚  (entry point   β”‚  event β”‚(your business β”‚
β”‚  or mobile) β”‚        β”‚   HTTP/REST)    β”‚        β”‚   logic )     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        └──────┬────── β”€β”˜
                                                         β”‚
                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
                              β”‚                          β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                     β”‚   DynamoDB    β”‚        β”‚      S3        β”‚
                     β”‚  (data)       β”‚        β”‚  (files)       β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

This pattern β€” API Gateway + Lambda + DynamoDB β€” is one of the most common serverless architectures on AWS.
It is scalable, cost-efficient for irregular workloads, and requires no servers to maintain.


IV. Your first Lambda handler in Go  

Prerequisites  

  • Go 1.21+
  • AWS CLI configured
  • Package github.com/aws/aws-lambda-go

Handler structure  

package main

import (
    "context"
    "fmt"

    "github.com/aws/aws-lambda-go/lambda"
)

type Event struct {
    Name string `json:"name"`
}

type Response struct {
    Message string `json:"message"`
}

func Handler(ctx context.Context, event Event) (Response, error) {
    if event.Name == "" {
        event.Name = "world"
    }
    return Response{
        Message: fmt.Sprintf("Hello, %s! You are running on AWS Lambda.", event.Name),
    }, nil
}

func main() {
    lambda.Start(Handler)
}

Build and deploy  

Lambda with Go requires a Linux binary:

GOOS=linux GOARCH=amd64 go build -o bootstrap main.go

zip function.zip bootstrap

aws lambda create-function \
--function-name my-first-lambda \
--runtime provided.al2 \
--handler bootstrap \
--role arn:aws:iam::123456789012:role/lambda-role \
--zip-file fileb://function.zip

Note :since Go 1.18, AWS recommends using provided.al2 with a binary named bootstrap.

Test the function  

aws lambda invoke \
  --function-name my-first-lambda \
  --payload '{"name": "Alice"}' \
  response.json

cat response.json

V. Real use cases  

1. Lightweight REST API  

The most common use case.
With API Gateway, Lambda can create HTTP endpoints without running a web server.

2. File processing on upload  

User uploads β†’ S3 β†’ Lambda β†’ processing β†’ S3

S3 (upload) ──▢ Lambda (resize) ──▢ S3 (versions)

3. Automation and scheduled tasks  

With EventBridge Scheduler, Lambda can run periodically:

  • cleanup jobs
  • reports
  • sync tasks

Serverless cron.

4. Message processing  

With SQS, Lambda consumes messages asynchronously and scales automatically.

Perfect for pipelines and event-driven systems.

5. Lambda@Edge  

Lambda@Edge allows running code close to users via CloudFront.

Use cases:

  • redirects
  • A/B testing
  • header manipulation
  • authentication at the edge

VI. Limits you must know  

LimitValue
Max duration15 minutes
Memory128 MB β†’ 10 240 MB
Package size50 MB zip / 250 MB unzipped
/tmp space512 MB (up to 10 GB configurable)
Default concurrency1000

Cold start  

When Lambda creates a new instance, there is an initialization delay.

With Go, cold starts are usually very small (< 100 ms).

Use Provisioned Concurrency for latency-sensitive apps.

Lambda fits when  

  • event-driven
  • short execution
  • variable load
  • fast delivery needed
  • low ops wanted
  • decoupled architecture

Not ideal for  

  • long jobs
  • stateful apps
  • constant heavy load

VII. Pricing  

Lambda billing is based on:

  • number of invocations
  • execution time Γ— memory

Example:

Requests: (5M - 1M gratuit) Γ— 0,20$ / 1M = 0,80$
Duration    : 5M Γ— 0,2s Γ— 0,128 GB Γ— 0,0000166667$/GB-s β‰ˆ 2,13$
Total    : ~2,93$ / month

For irregular workloads, Lambda is often cheaper than EC2 running 24/7.


Conclusion  

AWS Lambda has changed the way cloud architectures are designed. By removing the need to manage servers, it allows developers to focus on business logic, scale effortlessly, and pay only for what they actually use.

What we covered in this article:

  • Lambda is triggered by events coming from many AWS services
  • In Go, cold starts are minimal and performance is excellent
  • The API Gateway + Lambda + DynamoDB architecture is a proven pattern
  • Lambda is perfectly suited for irregular workloads, asynchronous processing, and lightweight APIs
  • The limits (15-minute max duration, cold starts) influence architecture decisions

Lambda is not a universal solution β€” for long-running tasks, stateful applications, or constant high workloads, EC2 or ECS/Fargate are often a better fit.
But for fast development, automatic scaling, and keeping costs under control, it is an extremely powerful tool.


πŸ”— Useful links  

  • AWS lambda
 Nx Is Not a JavaScript Tool: It Is a Work Orchestrator
Why Is Docker Cache Insufficient for a Monorepo? 
  • I. What is AWS Lambda?  
  • II. How does it work?  
  • III. Architecture diagram  
  • IV. Your first Lambda handler in Go  
  • V. Real use cases  
  • VI. Limits you must know  
  • VII. Pricing  
  • Conclusion  
  • πŸ”— Useful links  
Follow us

We work with you!

   
Copyright Β© 2026 Simple Enough Blog All rights reserved. | Powered by Hinode.
Simple Enough Blog
Code copied to clipboard