AWS Lambda is an event-driven computing cloud service from Amazon Web Services that allows developers to program functions on a pay-per-use basis without having to provision storage or compute resources to support them. This is sometimes referred to function-as-a-service (FaaS).
One of the main benefits of AWS Lambda is that it abstracts server management away from the IT professional. With AWS Lambda, Amazon manages the servers, which allows a developer to focus more on writing application code.
AWS supports code written in a variety of programming languages. AWS Lambda languages include Node.js, Python, Java and C#. Developers can also use code compiler tools, such as Maven or Gradle, and packages to build functions.
AWS Lambda limits the amount of compute and storage resources that you can use to run and store functions. The following limits apply per-region and can be increased. To request an increase, use the Support Center console.
Types of services
AWS offers thousands of discrete services -- nearly 2,000 were released in 2018 alone. AWS uses the AWS Lambda console to help users monitor and manage their Lambda applications. The menu includes stacks that you launch in AWSCloudFormation by using the AWS CloudFormation console, the AWS Serverless Application Repository, the AWS CLI, or the AWS SAM CLI.
AWS Lambda functions
A function is a small piece of programming that carries out a specific task. Developers use AWS Lambda to code and run functions in response to specific events in other Amazon cloud services, such as the creation of an object in an Amazon Simple Storage Service (S3) bucket. Each Lambda function runs in an isolated computing environment with its own resources and view of the file system.
When AWS Lambda functions are called, the storage and compute resources for that function spin up automatically as a metered service.
AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume -- there is no charge when your code is not running.
With Lambda, you can run code for virtually any type of application or backend service. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.
What can you build with AWS Lambda?
- Web applications: By combining AWS Lambda with other AWS services, developers can build web applications that scale up and down and run in multiple data centers.
- Mobile backends: You can build backends using AWS Lambda and Amazon API Gateway for the authentication and execution of API requests. For example, Bustle runs a serverless backend for its Bustle iOS app and websites using AWS Lambda and Amazon API Gateway.
- IoT backends: You can build serverless backends using AWS Lambda to handle web, mobile, Internet of Things (IoT), and 3rd party API requests.
- Data changes: AWS Lambda can be used to perform data validation, filtering, sorting, or other transformations for every data change in a DynamoDB table and load the transformed data to another data store. Because Amazon offers integration between DynamoDB, Amazon’s NoSQL database that uses JSON-based query language, and AWS Lambda, developers can configure a Lambda function to be triggered whenever your DynamoDB table receives an update. In a Lambda function you can do things such as sending notifications via Amazon SNS, writing to other DynamoDB tables, managing Cognito identity pools, as well as a number of other things both in and outside of AWS.
- Real-time stream processing: AWS Lambda and Amazon Kinesis can be used to process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering.
Current AWS Lambda uses by enterprises
Here are four examples of major enterprises using AWS Lambda, as of October 2019:
- iRobot:The consumer robot company and he maker of the internet-connected Roomba robotic vacuum, is building the next-generation of connected devices for the smart home using a serverless architecture. The iRobot platform, based on AWS Lambda and AWS IoT, is managed by fewer than 10 people.
- MLBAM:The digital arm of Major League Baseball offers Statcast to deliver real-time game-play data to broadcasters. MLBAM uses AWS Lambda to enhance and transform the raw data and increase the speed, scalability and ability for MLBAM to capture, analyze, and deliver large quantities of data to their fans.
- Guardian News Media: The publisher of the Guardian and the Observer uses AWS Step Functions to coordinate AWS Lambda functions to build reliable workflows. This serverless architecture allowed for rapid creation of new internal business workflows and orchestration of data across different systems.
- The Seattle Times:The largest daily newspaper in Washington State, with a website that gets 32 million page views each month, The Seattle Times uses AWS Lambda to resize images for viewing on different devices such as desktop computers, tablets, and smartphones
How developers use AWS Lambda
Developers can list, delete, update and monitor functions through the Lambda dashboard, command-line interface (CLI) or software development kit (SDK). The service also performs infrastructure-focused activities, such as server and operating system maintenance, patch deployment and logging through AWS CloudWatch. Lambda also supports third-party logging application programming interfaces (APIs), and developers can connect custom APIs endpoints to Lambda through the Amazon API Gateway service.
Amazon enabled serverless computing technology across its global locations with the release of its Lambda@Edge service. It enables developers to run Lambda code at edge locations that are geographically closer to end users around the world, reducing latency.
Amazon CloudFront Events trigger the AWS Lambda@Edge functions to run and deliver location-specific content to end users. Lambda@Edge runs code each time a function triggers, allowing it to scale according to the size of the workload. Developers can use AWS Lambda@Edge to manage HTTP responses and cookies, make network calls and conduct A/B tests.
AWS Lambda pricing and free tier
Amazon bills users based on the number of requests served and the compute time needed to run the code, metered in increments of 100 milliseconds. If a function is never called, it costs the developer nothing.
AWS Lambda is available with a free tier of service that includes one million free requests and 400,000 gigabyte-seconds of compute time per month. Amazon charges users for each additional million requests. Additional charges may incur within associated AWS products.