Think your company is ready to transition to a serverless architecture? Want to start using AWS Lambda ASAP? Take a minute to make sure you understand how the two are interrelated.
In the cloud industry, these exciting new options can help to reduce costs, increase agility, boost development speed and accelerate time to market. Like with any new architecture approach or technology component, however, there is some confusion about what a serverless architecture is and how the AWS Lambda service fits in.
First, Accenture AWS Business Group (AABG) wants to debunk a common misperception: the terms are not synonymous. Simply applying AWS Lambda to existing code, as some companies are doing in their haste to get to cloud, will not generate the desired results. Instead, think of the terms this way: If serverless architecture is a puzzle, AWS Lambda is a very important piece. (See sidebar for examples of Accenture-built serverless architectures that use AWS Lambda.)
Here’s a closer look at the distinction:
Serverless architecture—Traditionally, a company’s database tier, application tier and web tier are hosted on a separate group of servers. To transition to a serverless architecture, a company must break down applications or hardware products by domain (database, compute, storage, API, etc.) and move each component to an AWS service such as Amazon DynamoDB for database, Amazon Kinesis for analytics, Amazon Simple Storage Service (Amazon S3) for object storage or Amazon Simple Notification Services (SNS) for messaging.
To learn more about the benefits of a serverless architecture and its readiness for prime time, see this blog from Michael Liebow, global managing director, Accenture Cloud Platform.
AWS Lambda--A compute microservice that runs and scales code for numerous types of applications or back-end services without provisioning or managing servers. Companies upload code, set it to automatically trigger from other AWS services on an event, or to call an application directly--all paid for on a compute-time-only basis.
Applying AWS Lambda in a serverless architecture
AWS Lambda requires a trigger to perform the compute function, and the maximum function size is relatively small. The current AWS Lambda specifications include:
|Identity and access management—Function runs as this role to acquire permissions to other AWS resources.||Disk space—Each Lambda function receives 500MB of non-persistent disk space in its own /tmp directory, which is not adjustable.|
|Environment variables—Enable dynamic pass of settings to function code and libraries, without making changes to code.||Security—Files stored on AWS Lambda's local volumes are for temporary short-term storage only and do not persist beyond the lifetime of a single AWS Lambda function invocation.|
|Memory (and CPU)—Company selects amount of memory needed for function and AWS allocates proportional CPU power and other resources. At publication of this blog, the minimum/maximum of RAM available is in 64MB increments from 128MB to 1.5GB.|
One way to think of AWS Lambda is as an interaction layer to perform a single, simplified compute component of a serverless architecture—over and over. For example, in a real-time scenario, when a customer types a tracking number into a website and presses enter, it would invoke an AWS Lambda function to connect to a database, storage, images or other data, and then prepare the information so that when the website loads the next page it is ready to be displayed on the site.
AWS Lambda can also handle interactions between multiple services. In a batch scenario example, a company processing nightly inventory could invoke a series of AWS Lambda functions to pull the data from a transaction database, transform and load the data into a reporting database, and automatically create and email a PDF to specified recipients.
Since AWS Lambda is intended to perform well-defined compute functions only, building an AWS Lambda function requires a different thought pattern than traditional software development. Instead of moving a standalone, monolithic application to the cloud, a company would need to break up the application into modules, such as the tracking number submittal module or the transaction processing module just described.
Then software developers rewrite the code as AWS Lambda functions stored in the cloud and called on-demand from AWS. In a DevOps approach, the idea would then be to reuse that code in all future native-cloud development efforts. In time, a company could have an entire library of AWS Lambda functions from which to choose.
Maximizing the AWS services ecosystem
While most hyper-scale cloud providers offer serverless microservices/functions as a service, AWS is currently the only cloud provider that offers the entire ecosystem to build serverless architectures in the cloud—all maintained and managed by AWS. The missing compute piece was AWS Lambda and now it is enterprise-ready.
Based on AABG’s experience, here are some tips for developing a serverless architecture on the AWS Cloud and identifying where to use AWS Lambda for the compute function:
Serverless architectures leveraging AWS Lambda
The Accenture Lightweight Architectures practice is creating serverless architectures for clients on various hyper-scale cloud providers. In the case of the AWS Cloud, the team consults with the Accenture AWS Business Group to identify use cases for applying AWS serverless products, including AWS Lambda as the compute function, in these high-performance, low-cost and secure serverless architectures:
An app that instantly and securely scales AWS server capacity from zero to more than 5 million servers to meet fluctuating demand for a one-time sporting event
An orchestration engine and API platform for a cruise line
An Internet of Things-driven automated prescription replenishment service for a healthcare provider
A distributed point-of-sale system that uses any device, anywhere to complete orders and process payments for a food company.
Identify which modules or components to transfer and map to available AWS services—Applications generally have a four-tier structure:
Database—Amazon DynamoDB, a NoSQL database with open standards that dynamically scales; Amazon Relational Database Service (RDS), a platform for transactional records and quick analytics.
Application programming interface—Amazon API Gateway to provide secured access to AWS Lambda for internal and external calls.
Storage—Amazon Simple Storage Service (Amazon S3) with integrations, commands, connectivity and authentication built in.
Modify approach to security monitoring—AWS CloudTrail logs which services invoke AWS Lambda and the length of time the compute function executes. Lambda integrates with Amazon CloudWatch, providing monitoring details for each function. During an execution, it monitors the number of requests, latency per request, and the number requests that result in an error with detailed error logging. These metrics can be used in custom CloudWatch alarms for automatic remediation action or to alert key personnel. The CloudWatch AWS Lambda logs can also provide performance information to identify bottlenecks in the solution and to right-size the function parameters.
Update cloud responsibility model—Defines where handoff takes place between the underlying high-availability hardware that AWS is responsible for and the workloads and applications that run on top of AWS services that the company is responsible for. Amazon Inspector is a static code analysis tool that software developers can use to review and verify code meets company-specified security requirements. In addition, the company is responsible for specifying the service accounts and correct AWS Lambda permissions.
Rethink performance monitoring for compute—AWS Lambda code snippets must be uploaded to the AWS Cloud for testing duration and throttle; they cannot be run locally. AWS X-Ray is used to trace the flow of data and logic within AWS Lambda and how it maps to other AWS services to determine whether the issue is in the AWS Lambda code versus how it is calling data from another product.
Putting it all together
Now that AWS Lambda—the missing piece of the puzzle—is widely available, companies can kick-start their serverless architecture development and capitalize on the advantages. To learn more, contact firstname.lastname@example.org.