• Understanding AWS Lambda

Let us start understanding AWS Lambda with various features, working, and important terms.

  • compute service to run code
  • No need to provision/manage servers, even on AWS with no server administration
  • code is executed when needed
  • automatic scaling as per code requests
  • payment for compute time consumed
  • execute code for any software application
  • automatically does
    • compute resource administration
    • server and OS maintenance
    • capacity provisioning
    • scaling
    • code monitoring
    • logging
  • tightly integrated with other AWS service like S3
  • code executed against event trigger like change in S3 table
  • execute custom code by using APIs
  • create serverless applications
  • Lambda functions execute in serverless environment for event processing
  • Every Lambda function instance is executed in isolated context

Lambda Working

  • one event at a time is processed.
  • Lambda service receives an event trigger
  • Lambda service instantiates the associated code to process event
  • Response is sent by Lambda service, after execution completes
  • Lambda service waits for another event.

Important terms

  • Function – code block/script/program which Lambda executes. events passed to it by AWS and response taken
  • Runtimes – provide execution environment as per programming language. Available for different languages. Is between Lambda service and Lambda function
  • Layers – to distribute libraries/custom runtimes/function dependencies
  • Event source – Are AWS service which trigger Lambfa function to run it
  • Downstream resources – Are AWS services called by Lambda function. usually DynamoDB tables/S3 buckets
  • Log streams – custom logging statements of Lambda function code by annotation
  • SAM – Or Serverless Application Model for defining serverless applications.

Lambda working

Use case of automatic resizing of uploaded image

Lambda limits

ResourceLimit
Total Function memory allocation128 MB to 3,008 MB, in 64 MB increments.
Total Function timeout900 seconds (15 minutes)
Total Function environment variables4 KB
Total Function resource-based policy size20 KB
Total Function layers5 layers
Maximum Invocation frequency (requests per second)10 times the concurrent executions limit for synchronous from all sources 10 times the concurrent executions limit for asynchronous from non-AWS sources Unlimited for asynchronous from AWS service sources
Total Invocation payload (sum of both request and response)6 MB for synchronous and 256 KB for asynchronous
Total size of deployment package50 MB maximum for zipped and for direct upload 250 MB for unzipped even including layers 3 MB for console editor
Count of Test events (console editor)10
Total, /tmp directory storage512 MB
Count of File descriptors1,024
Count of Execution processes/threads1,024

AWS Lambda-based application lifecycle

  • Develop the  code
  • deploy the developed and tested code to AWS Lambda
  • monitor for performance
  • troubleshoot if any error
  • AWS Lambda supported languages, their tools and options
LanguageTools and Options for Authoring Code
Node.jsAWS Lambda consoleVisual Studio, with IDE plug-in own authoring environment
JavaEclipse, with AWS Toolkit for Eclipse IntelliJ, with the AWS Toolkit for IntelliJown authoring environment
C#Visual Studio, with IDE plug-in .NET Core own authoring environment
PythonAWS Lambda consolePyCharm, with the AWS Toolkit for PyCharmown authoring environment
RubyAWS Lambda consoleown authoring environment
Goown authoring environment
PowerShellown authoring environment PowerShell Core 6.0 .NET Core 2.1 SDK AWSLambdaPSCore Module

Get ready to pass the AWS Certified Developer – Associate Practice Exam with practice exam Now!

Menu