AWS Releases Updates to Lambda Platform for Scaling High Volume Production Applications
|Stuart Parkerson in Programming Tuesday, April 14, 2015|
The platform Lambda was created to provide the scale and the responsiveness necessary to host high-volume production applications. The AWS team has announced that Lambda is now generally available, providing the ability to run up to 100 concurrent requests per account, up from 50 during the preview period.
The Lambda computer service runs code in response to events and automatically manages the compute resources for developers, facilitating applications that respond quickly to new information. AWS Lambda starts running code within milliseconds of an event such as an image upload, in-app activity, website click, or output from a connected device.
Developers can also use AWS Lambda to create new back-end services where compute resources are automatically triggered based on custom requests. AWS Lambda users pay only for the requests served and the compute time required to run the code. Billing is metered in increments of 100 milliseconds, making it cost-effective and possible to scale automatically from a few requests per day to thousands per second.
The code you run on AWS Lambda is called a “Lambda function.” After creating a Lambda function it is always ready to run as soon as it is triggered, similar to a formula in a spreadsheet. Each function includes the code as well as some associated configuration information, including the function name and resource requirements. Lambda functions are “stateless,” with no affinity to the underlying infrastructure, so that Lambda can rapidly launch as many copies of the function as needed to scale to the rate of incoming events.
After you uploading code to AWS Lambda, developers can associate their function with specific AWS resources such as a particular Amazon S3 bucket, Amazon DynamoDB table, Amazon Kinesis stream, or Amazon SNS notification. Then, when the resource changes, Lambda will execute the function and manage the compute resources as needed in order to keep up with incoming requests.
New features include:
- Synchronous Invoke: Applications can now invoke a Lambda function synchronously and receive a response as soon as it finishes executing. The arguments and the response can be expressed in JSON notation.
- New Triggers: Developers can now invoke Lambda functions using Amazon Simple Notification Service (SNS) notifications as triggers. Developers can also invoke them in response to a request made via the AWS Mobile SDK (Android and iOS).
- Simplified Access Model: Developers can now use a single IAM role (instead of the pair that were previously required) to grant execution permission to Lambda functions. The console includes one-click role creation and will also help bring existing execution roles into conformance with the new, simpler model.
- Cross-Account Access to Resources: Lambda has also added support for resource based policies and cross account access, allowing the ability to grant permissions to invoke Lambda functions from another AWS account.
- Enhanced Console: Developers can use the AWS Management Console to add, edit, and remove Amazon Kinesis streams as event sources. They can also view all event sources for a Lambda function in one place, making it easier to see what’s triggering function.
- Multiple Functions: Developers can attach more than one Lambda function to a single Kinesis or DynamoDB stream. To do this with a Kinesis stream, AWS recommends having sufficient shards to handle the expected number of concurrent requests.
- Enhanced Metrics & API: AWS has added metrics for throttling, has improved the event source management APIs, and streamlined Lambda’s programming model.
- Cognito Events: Developers can now invoke a Lambda function as part of the synchronization process for a Cognito Dataset.
In a recent blog post, AWS’s Jeff Barr had these comments:
Developers are already using Lambda as an integral part of sophisticated mobile apps. They are able to create scalable server-side components (the mobile backend) without having to think about compute, storage, load balancing, and the like. However, the asynchronous processing model means they cannot use it in latency sensitive tasks, such as responding to in-app activity.
The new Synchronous Invoke feature … is a great fit for this use case. Lambda functions that have been invoked in synchronous fashion via the Mobile SDK receive detailed context information as part of the request. They have access to application data (name, build, version, and package), device data (manufacturer, model, platform), and user data (the client id). Because function are invoked within milliseconds, the mobile backend can respond to requests with great rapidity. You can improve your overall app experience without having to worry about hosting or scaling backend code.
The AWS Mobile SDKs for Android and iOS now include support for the new Synchronous Invoke feature. You can also use the AWS Mobile SDK as an event source in order to run your Lambda code in response to events that occur on the mobile device.
Amazon Cognito is a service that makes it easy to save user data, such as app preferences or game state, in the AWS Cloud without writing any backend code or managing any infrastructure. You can now trigger execution of your Lambda functions when Cognito syncs a Dataset. Your Lambda function can participate in the sync operation by validating, filtering, or modifying the incoming data.
Use Cases for AWS Lambda
- Back-end Service: AWS Lambda facilitates building back-end services to perform workloads such as image analysis, document transformation, and indexing. This enables you to architect your applications more effectively by moving client-side logic to a Lambda function so that you can avoid client platform variations, reduce battery drain, and enable easier updates.
- Stream Processing: AWS Lambda functions can be triggered by data stream updates from Amazon Kinesis and Amazon DynamoDB. For instance, developers can watch for a pattern, such as an address, and trigger an alert.
- Data Triggers: AWS Lambda can trigger compute functions such as creating thumbnails when new images are added to Amazon S3, running sophisticated calculations on data after it is loaded into Amazon DynamoDB, or perform watermarking or compression when new documents are uploaded to Amazon S3.
- Scheduled Tasks: AWS Lambda functions can be triggered by external event timers, so functions can be run during regularly scheduled maintenance times or non-peak hours. For example, developers can trigger an AWS Lambda function to perform nightly archive cleanups during non-busy hours.
- Data Indexing and Synchronization: Many developers store objects in Amazon S3 while using Amazon DynamoDB to store and index the object metadata and enable high speed search. AWS Lambda makes it easier to keep everything in sync by running a function to automatically update the index in Amazon DynamoDB every time objects are added or updated from Amazon S3.
- Auditing and Notification: AWS Lambda makes it simple to track log files and audit records, whether they arrive as Amazon S3 objects, Amazon DynamoDB table updates, or Kinesis stream records. AWS Lambda allows developers to run code to automatically scan for changes, detect anomalies, and send notifications through Amazon SNS or other means when a problem is detected.
- Internet of Things (IoT): AWS Lambda functions can be triggered by events from connected devices like weather sensors or house alarms. For example, creating an AWS Lambda function that sends a customized Amazon SNS notification when a smart thermostat indicates that the temperature is outside a defined limit. Or creating a Lambda function to monitor and act on device data in an Amazon Kinesis stream, enabling the ability to connect smart appliances, home lighting systems, connected parking meters, or industrial machines to AWS services.
- Build Custom Back-end Services: Developers can use AWS Lambda to create new back-end services for applications that are triggered on custom requests using the Lambda API. Using Lambda to process custom events instead of servicing these on the client, provides the ability to avoid client platform variations, reduce battery drain, and enable easier updates.
- Completely Automated Administration: AWS Lambda manages the entire infrastructure to run code on highly available, fault-tolerant infrastructure, freeing developers to focus on building differentiated back-end services. Lambda eliminates the need to update the underlying OS when a patch is released, or worry about resizing or adding new servers as usage grows. AWS Lambda seamlessly deploys code, does all the administration, maintenance, and security patches, and provides built-in logging and monitoring through Amazon CloudWatch.
- Built-in Fault Tolerance: Lambda has built-in fault tolerance as it maintains compute capacity across multiple Availability Zones in each region to help protect code against individual machine or data center facility failures. Both AWS Lambda and the functions running on the service provide predictable and reliable operational performance. AWS Lambda is designed to provide 99.99% availability for both the service itself and for the functions it operates. There are no maintenance windows or scheduled downtimes.
- Automatic Scaling: AWS Lambda invokes code only when needed and automatically scales to support the rate of incoming requests without requiring developers to configure anything. There is no limit to the number of requests code can handle. AWS Lambda typically starts running code within milliseconds of an event, and since Lambda scales automatically, the performance remains consistently high as the frequency of events increases. Since the code is stateless, Lambda can start as many instances of it as needed without lengthy deployment and configuration delays.
- Integrated Security Model: AWS Lambda allows the code to securely access other AWS services through its built-in AWS SDK and integration with AWS Identity and Access Management (IAM).
To learn more Amazon is hosting a webinar covering the platforms abilities on April 30 at 12:30 CST.
Read more: https://aws.amazon.com/lambda/
Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.
MEMBERS GET ACCESS TO
- - Exclusive content from leaders in the industry
- - Q&A articles from industry leaders
- - Tips and tricks from the most successful developers weekly
- - Monthly issues, including all 90+ back-issues since 2012
- - Event discounts and early-bird signups
- - Gain insight from top achievers in the app store
- - Learn what tools to use, what SDK's to use, and more