Getting to know AWS Lambda - FaaS

— 2 minute read

AWS Lambda is a FaaS (Function as a Service), a serverless approach to code units. I have been using AWS Lambda for a while and I am impressed by its capabilities. Let me do a writeup on the basics, pros and cons.

Under the hood permalink

Under the hood, Lambda uses docker containers to run your code. The container is ephemeral because it may only last for one invocation or a few invocations depending upon the frequency. Function as a Service here does not mean you can only run a single function. I have my big Python project including dependent libraries inside lambda.

Important features permalink

  • Fault tolerance - Since your code is maintained in multiple instances
  • Scalability - AWS scales the compute capacity based on the incoming request without needing any configuration
  • Integration with other AWS Services like S3, API Gateway, SNS, CloudFront, DynamoDB
  • On demand - You won't be charged when not invoked. Pretty cool!
  • Ability to call other lambda functions from one lambda
  • Support many programming languages like Java, Python, Node.js, C#, Go, and so on.
  • 1,000,000 free requests per month under free tier

Limitations & caveats permalink

  • Maximum execution time is 15 mins (previously 5 mins)
  • The temporary directory size is 512 MB, so you need to be careful when downloading big files
  • By default maximum of 1000 concurrent executions can happen for an AWS account. This is to protect unexpected costing. So, for production system, raise a request with AWS to increase the limit.

Tools permalink

Though you can manage Lambda from AWS console, it is suggested to use other tools to manage the development and deployment. A few options are,

Eg:

aws lambda create-function --function-name test --runtime nodejs8.10 --role arn:aws:iam::XXXXXXXXXXXX:role/my-role --handler tensorml --region ap-south-1 --zip-file fileb://./Test.zip

AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment

The Serverless Framework helps you develop and deploy your AWS Lambda functions, along with the AWS infrastructure resources they require.

Thank you!