AWS 101: Why You Should be Deploying AWS Lambda to Run Code
Running code can get tricky and time-consuming. After all, you need to provision and manage your servers to make it happen, right? Not if you’re in the cloud and are deploying AWS Lambda. You don’t even have to think about servers.
What is AWS Lambda?
This highly available, serverless compute service runs your code in response to such events as HTTP requests, object modifications in Amazon S3 buckets, state transitions or updates on a compute infrastructure.
You can use Lambda to extend your AWS services or create your own back-end services and applications that operate with the security, performance and scale that AWS cloud delivers.
Lambda takes care of your compute fleet with balanced memory, CPU and other resources. You have zero administration responsibilities. You can set up your code to automatically trigger from AWS services or be called directly from any web or mobile app. Lambda does the rest to run and scale it with high availability.
AWS Lambda manages and maintains your underlying compute resources. Some of these include monitoring fleet health, patching security issues, deploying code, provisioning capacity and more.
How Does AWS Lambda Work?
When you use Lambda, your code is ready to run as soon as it is triggered. All you have to do is upload it; Lambda pretty much takes care of the rest by running, scaling and maintaining it. It natively supports Java, Go, PowerShell, Node.js, C#, Python and Ruby code. It also offers a Runtime API to assist you in using other programming languages.
The code you run on Lambda is known as a “Lambda function.” You run these to process the kinds of events I’ve mentioned above.
There are a few things you should know about Lambda functions. First, functions include not only your code but also such configuration information as function name and resource requirements. They are “stateless,” which means they aren’t connected to the underlying infrastructure, so Lambda can launch multiple copies of the function to scale with incoming events.
Second, once you upload the code, you can associate your Lambda function with different AWS resources. When you create a function, Lambda automatically provides an execution role with minimal permissions to access various services like Amazon S3 and Amazon DynamoDB, for example. You can also access permissions in the Amazon Identity and Access Management (IAM) console for more granular control.
Why Should I be Using AWS Lambda?
What does this mean for you? Here’s a look at some of the reasons why using AWS Lambda to run code in a serverless computing environment is something to consider:
You don’t have to manage servers.
Because AWS Lambda automatically runs your code once you write it and upload it, you don’t need to worry about servers, provisioning or maintenance.
It provides continuous scaling.
AWS Lambda runs your code in response to triggers and scales your application as needed. The code runs parallel to process each trigger individually. This means it scales with the size of the workload.
You get subsecond metering.
Pay only for the compute time consumed. You’re charged for every 100ms your code executes and the number of times it’s triggered.
AWS Lambda delivers consistent performance.
You are able to choose the right memory size for your function to optimize code execution time and enable “Provisional Concurrency” to keep functions initialized and ready to respond quickly.
The reasons to take a hard look at AWS Lambda are plentiful, especially if you want to write code but not manage it (or servers). It’s a vital Amazon Web Services tool to consider as you work your way through our AWS 101 series, which includes looks at using Amazon S3 and Amazon EC2 among other must-know aspects of this cloud platform. Stay tuned for more AWS insight and thanks for reading!