Tuesday, August 5, 2025

AWS Lambda | Overview & Hands-On.

AWS Lambda - Overview & Hands-On.

Scope:

  • Intro,
  • The concept:  AWS Lambda,
  • Key Features,
  • Common Use Cases,
  • Supported Runtimes languages,
  • Trigger Sources (Event Sources),
  • Pricing (what twtech pays for),
  • Sample Use Case- Auto Image Resizing with Lambda
  • Deployment Options,
  • Top Benefits of AWS Lambda,
  • Project: Hands-On.

Intro:

  • Here’s twtech overview of AWS Lambda, explained in a clear, beginner-friendly perspective,

 The concept:  AWS Lambda

  • AWS Lambda is a serverless compute service from Amazon Web Services (AWS) that lets twtech to run code without provisioning or managing servers.
  • twtech simply upload its code, set a trigger (like an API call or file upload), and AWS runs it for twtech.

 Key Features

Feature

Description

Serverless.

No need to manage servers or infrastructure

Event-driven.

Triggers can be S3 uploads, API calls, DynamoDB updates, cron jobs, etc.

Auto-scaling.

Automatically scales up/down with demand

Pay-per-use.

twtech pays only when your function is invoked (ms-based billing)

Stateless.

Functions don’t keep data between invocations (use S3, DynamoDB, etc.)

Short-lived executions.

Max run time per invocation: 15 minutes

Common Use Cases

Use Case

Description

API backend.

Build scalable APIs using API Gateway + Lambda

Image or video processing.

Process media on the fly after S3 uploads

Automation & cron jobs.

Scheduled tasks using EventBridge (CloudWatch Events)

IoT data processing.

React to IoT device messages in real time

Serverless websites.

Backend logic for static websites hosted on S3 + CloudFront

Data transformation.

ETL (Extract, Transform, Load) operations in data pipelines

 Supported Runtimes languages:

  • Python
  • Node.js
  • Java
  • Go
  • .NET Core (C#) & / Powershell 
  • Ruby
  • Custom runtimes (e.g., Rust, PHP, etc. via Lambda layers)

 Trigger Sources (Event Sources)

Source

Example

Amazon S3.

File uploaded → run Lambda to process the file

API Gateway.

HTTP request → run Lambda to return response

EventBridge.

Scheduled cron job → run Lambda daily/hourly

DynamoDB Streams.

New DB item → run Lambda to process it

SNS / SQS.

Message received → run Lambda

 Pricing (what twtech pays for):

  1. Number of invocations (first 1M/month = free)
  2. Execution time (based on memory & duration)

Example:

  •  A function that runs for 1 second using 128MB RAM = ~$0.000000208 per execution.

 Sample Use Case- Auto Image Resizing with Lambda:

  1. User uploads an image to S3.
  2. That triggers a Lambda function.
  3. Lambda resizes the image and stores the result in another S3 bucket.

NB:

  • No servers is required, 
  • No manual scaling is needed. 
  • Just write the code and it runs when needed.

 Deployment Options

  • Use the AWS Console (web UI)
  • Use AWS CLI or SAM (Serverless Application Model)
  • Use frameworks like:
    • Serverless Framework
    • Terraform
    • CDK (Cloud Development Kit)

Top Benefits of AWS Lambda

  • Here are the top benefits of using AWS Lambda, especially when twtech is looking for: 
    • Efficiency, 
    • Scalability,
    • Lower operational overhead.

1. No Server Management (Serverless)

  • twtech doesn’t have to manage, patch, or scale servers.
  • AWS handles the entire infrastructure for you.

 NB:

  • Great for developers — twtech focuses on twtech code.

2. Automatic Scaling

  • Lambda automatically handles scaling up or down based on the number of incoming events or requests.
  • Whether twtech has 10 or 10,000 requests per second, Lambda adjusts instantly.

3. Pay Only for What twtech Uses

  • No idle time billing — you pay only when your code runs.
  • Pricing is based on:
    • Number of requests
    • Execution duration
    • Memory allocation

 NB:

  • twtech Can save a lot of money compared to always-on EC2 instances.

4. Event-Driven

  • Lambda integrates natively with many AWS services:
    • S3 (file upload triggers)
    • DynamoDB (stream triggers)
    • API Gateway (web/API requests)
    • CloudWatch/EventBridge (scheduled events)
    • SNS/SQS (messaging queues)

 NB:

  • Great for automation, real-time processing, and reactive systems.

5. High Availability & Fault Tolerance

  • Lambda functions are run across multiple Availability Zones by default.
  • AWS automatically ensures reliability and redundancy.

 NB:

  • No extra configuration needed to make it highly available.

6. Easy Deployment

  • Code can be uploaded directly or via deployment tools (CLI, SAM, CDK).
  • Supports versioning and aliases for safe deployments and rollbacks.

7. Multiple Language Support

  • Writes twtech functions in:
    • Python
    • Node.js
    • Java
    • Go(Golang)
    • C# (.NET Core)
    • Ruby
    • Or even custom runtimes

 NB:

  • Supports flexibility for different tech stacks.

8. Secure by Design

  • Integrated with IAM (Identity and Access Management)
  • twtech can define fine-grained permissions for what its Lambda function can access.

 NB:

  • Ensures least-privilege access and better security posture.

9. Granular Monitoring & Logging

  • Integrated with Amazon CloudWatch for:
    • Logs
    • Metrics
    • Alerts

NB:

  • Helps in easy debugging and performance tuning.

10. Faster Time to Market

  • With less time spent on infrastructure, you can focus on building features quickly.
  • Ideal for startups, prototypes, MVPs (Minimum Viable Products), and microservices.

 NB:

  • It Speeds up development cycles and iterate faster.


Project: Hands-On

  • How twtech creates and use AWS Lambda for Resources.

Search for aws service: Lambda.

Create a function:


Next 

  • twtech accesses events: Lambda responds to events

  • How Lambda Function works:

NB:

  • Scaling up lambda function is automatic: by clicking on any of input sources

  • Next twtech needs to: Scale seamlessly

  • Next: create a function

Create function
twtech needs to Choose one of the following options to create its function

  • Architecture
  • twtech Chooses the instruction, then set architecture it wants for its function code.

  • Change default execution role or create one

Additional configurations

  • Use additional configurations to set up code signing, function URL, tags, and Amazon VPC access for twtech function.


  • twtech tests the function created: twtech-app-function

  • Test function:

  • Execution successful:

  • twtech checks the details of the function executed:


  • twtech saves the lambda events:


  • twtech monitors its Lambda function: twtech-app-function

  • CloudWatch logs can also be viewed: For Observability


  • Accessing logs streams:

  •  twtech sets general configuration of its Lambda function.

  • Edit basic settings

  • Save changes:

  • How to view basic Lambda role execution:


  • How twtech views roles created for Lambda function: Permissions(roles) can be edited



  • View role document:twtech-app-functon-role-document

  • How twtech added triggers to its Lambda Function:

  • Select the : Triggers and add





No comments:

Post a Comment

Databases Explained & Use Cases with (Flash Card) | Overview.

Databases Explained  & Use Cases ( Flash Cards)   - Overview. A database is a structured collection of digital information designed f...