AWS Lambda Mega Cheat Sheet

Piggybank getting filled with coins

$0.0000002 / request

Every time you invoke a Lambda function, you save your pennies.

  • Free-forever tier
  • Pay per request
  • Pay for just millis
Lambda mega cheatsheet logo

Create a Lambda Function from AWS CLI

Don’t know how to setup AWS CLI? Follow this guide.

aws lambda create-function --function-name hello-fn --role arn:aws:iam::acc_no:role /eg-role

From Servers to No Servers (Serverless)

AWS Lambda does need servers but AWS manages the scaling, patching, and upgradation of the servers.

servers dissapearing in thin air to make serverless

Lambda Runtimes

  • NodeJS
  • Python
  • Go
  • Java
  • .NET
  • Amazon Linux

Logos of JavaScript, Python and Java

Lambda Cold Start

Thermometer showing low temperature

Just as it takes some time for a thermometer to take your temperature, an AWS Lambda instance takes a few seconds to launch.

To optimize, do these:

  • Reserve concurrency
  • Tree shaking

AWS spins up 2+ Lambda instances to handle website load

Request coming from browser to AWS Lambda

AWS Services You Can Use to Trigger a Lambda

DynamoDB

React to changes

SNS

Events Processing

S3

Resize Images

SQS

Batch Processing

API Gateway

REST APIs

AWS Lambda triggers with DynamoDB, API Gateway, SNS, Amazon S3

More ways to trigger

  • Function URL
  • Step functions
  • Event Bridge
  • CloudFront
  • AWS CLI
  • AWS SDK

Environment Variables

Lambda Role

Every AWS service needs an IAM role to perform any action on your behalf.

Secret QR code for discount

You found the treasure! Scan to get 15% off on LearnAWS course.

Lambda logs to CloudWatch

  • Find error messages
  • Get real time logs with live tail
  • Set alarms for an specific event
  • Setup Anomaly Detection with logs
  • Monitor performance with Insights
AWS Lambda logs going into CloudWatch through funnel

Lambda Layers

Lambda Versions

Keep your old Lambdas in multiple version, just like Git. Switch back to an older version anytime, anywhere.

Hills 🏔 and Skills, What's Common?

They both need you to be on top.

You will get lifetime access with:

All yours, just at:

$149

Just type and your search result will magically appear here