AWS Lambda: In-Depth Coverage

AWS Lambda is Amazon’s serverless computing service, which allows customers to execute their code in response to events without managing the underlying compute infrastructure, such as provisioning and managing the servers. The service executes code only when needed and scales automatically.

AWS Lambda supports Java, Node.js, C#, and Python code. Lambda also allows use of any third party library.

AWS Lambda Workflow
AWS Lambda Workflow

AWS Lambda function

The code you run on Lamda is called a Lambda Function. Every Lambda function will carry associated configuration information such as name, description, entry point, and resource requirements.

The function has to be stateless, which means the code must be written with no affinity the underlying infrastructure. This allows Lambda to create as many copies of the function rapidly to meet the demand of incoming events.

AWS Lambda: What does it do

  • Runs code on high-availability compute infrastructure.

  • Takes care of all the compute resource administration such as server and Operating system maintenance, capacity provisioning, code and security patch deployment.

  • Built-in code monitoring and logging through Amazon  CloudWatch

  • Automatic Scaling

  • Automatic OS updates

AWS Lambda: Benefits

Lambda enjoys all the advantages and disadvantages that come with serverless computing.

Since the underlying infrastructure is managed by Amazon Web Service, IT teams using Lambda need not worry about provisioning and managing the servers. This moves the administrative tasks from internal teams to external (AWS ) teams, thus reducing labor hours, time to implementation and costs.

Lamda will automatically scale the application, to match the demand. Since you are only paying for the amount of time your code is running, it reduces overall infrastructure costs. Users pay for every 100ms their code executes and the number of times their code is triggered.

The service inherently has high fault tolerance as Lambda maintains compute capacity across multiple availability zones. This protects the code from going down due to an individual machine failure or a data center outage.

Real-time scaling of compute resources is another big advantage of serverless computing platforms. According to AWS,

AWS Lambda invokes your code only when needed and automatically scales to support the rate of incoming requests without requiring you to configure anything.

There is no limit to the number of requests your code can handle. AWS Lambda typically starts running your code within milliseconds of an event, and since Lambda scales automatically, the performance remains consistently high as the frequency of events increases.

Since your code is stateless, Lambda can start as many instances of it as needed without lengthy deployment and configuration delays.

Lambda@Edge, a feature of Amazon’s Content Delivery Network, Amazon CloudFront, allows users to execute Lambda functions in AWS locations closer to the viewer.

AWS Lambda Limits

Amazon limits the amount of compute and storage resources that is used to run and store functions. Customers can request AWS to increase these limits.

The following table shows the number of concurrent executions allowed for a function and storage

ResourceDefault Limit
Concurrent executions1000
Function and layer storage75 GB

The following table shows  function configuration, deployments, and execution. These limits cannot be increased

ResourceLimit
Function memory allocation128 MB to 3008 MB, in 64 MB increments.
Function timeout900 seconds (15 minutes)
Function environment variables4 KB
Function resource-based policy20 KB
Function layers5 layers
Invocation payload (request and response)6 MB (synchronous)256 KB (asynchronous)
Deployment package size50 MB (zipped, for direct upload)250 MB (unzipped, including layers)3 MB (console editor)
Test events (console editor)10
/tmp directory storage512 MB
File descriptors1024
Execution processes/threads1024

AWS Lambda Service Level Agreement

AWS guarantees a Monthly Uptime Percentage of at least 99.95%. If Lambda does not meet the SLA, customers will be eligible for a service credit calculated as shown below.

Monthly Uptime PercentageService Credit Percentage
Less than 99.95% but greater than or equal to 99%10%
Less than 99%25%

For up to date SLA information please visit this page

AWS Lambda Pricing

AWS uses the pay as you go pricing model for Lambda. Users only pay for the resources they consume. Charges are based on the number of times you request your function and the amount of time it takes to execute the code.

Customers who want to try the service can use the free tier, which offers 1M free requests/month and 400,000 GB-seconds of compute time/month.

Once you exceed the free request limit, you will have to pay
$0.20 for every additional 1M requests. After you exceed the compute time limit, you will have to pay $0.00001667 for every additional GB-Second.

The fee tier does not automatically expire after 12 months as a lot of other free AWS services do. The memory size which you select for Lambda function will affect the duration you will be able to use the service.

Memory (MB)Free tier seconds per monthPrice per 100ms ($)
1283,200,0000.000000208
1922,133,3330.000000313
2561,600,0000.000000417
3201,280,0000.000000521
3841,066,6670.000000625
448914,2860.000000729
512800,0000.000000834
576711,1110.000000938
640640,0000.000001042
704581,8180.000001146
768533,3330.000001250
832492,3080.000001354
896457,1430.000001459
960426,6670.000001563
1024400,0000.000001667
1088376,4710.000001771
1152355,5560.000001875
1216336,8420.000001980
1280320,0000.000002084
1344304,7620.000002188
1408290,9090.000002292
1472278,2610.000002396
1536266,6670.000002501
1600256,0000.000002605
1664246,1540.000002709
1728237,0370.000002813
1792228,5710.000002917
1856220,6900.000003021
1920213,3330.000003126
1984206,4520.000003230
2048200,0000.000003334
2112193,9390.000003438
2176188,2350.000003542
2240182,8570.000003647
2304177,7780.000003751
2368172,9730.000003855
2432168,4210.000003959
2496164,1030.000004063
2560160,0000.000004168
2624156,0980.000004272
2688152,3810.000004376
2752148,8370.000004480
2816145,4550.000004584
2880142,2220.000004688
2944139,1300.000004793
3008136,1700.000004897

For up to date information please visit AWS Lambda Pricing Page here