AWS Lambda
An event driven computing service
for dynamic applications
Server Free Backend
- You don’t have to configure, launch, or monitor EC2 instances.
- You don’t have to install any operating systems or language environments.
- You don’t need to think about scale or fault tolerance
- You don’t need to request or reserve capacity.
Freshly created Function
- A freshly created function is ready and able to handle tens of thousands of requests per hour.
- Absolutely no incremental effort on your part.
- Very cost-effective.
- Each event is processed individually so thousands of functions can run in parallel and performance remains consistently high regardless of the frequency of events.
Runs within milliseconds of events
- Runs your code in response to events.
- Automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information.
- Starts running your code within milliseconds of an event such as an image upload, in-app activity, website click, or output from a connected device.
Pay only for requests served
- Pay only for the requests served and the compute time required to run your code.
- Billing is metered in increments of 100 milliseconds, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second.
- First 1 million requests per month are free
- $0.20 per 1 million requests thereafter ($0.0000002 per request)
Associate Lambda w/resources
-
After uploading, you associate your function with specific AWS resources
- a particular S3 bucket,
- DynamoDB table, or
- Kinesis stream.
- Lambda will then arrange to route events (generally signifying that the resource has changed) to your function.
Trigger: change in resource
- When a resource changes, Lambda will execute any functions that are associated with it.
- It will launch and manage compute resources as needed in order to keep up with incoming requests.
- It will shut them down if they are no longer needed.
-
Lambda is accessible from the
-
AWS Management Console,
-
the AWS SDKs and
-
the AWS Command Line Interface (CLI).
-
-
The Lambda APIs can be used to connect existing code editors and other development tools to Lambda.
Lambda programming model
- The function has access (via a parameter supplied along with the POST) to a JSON data structure.
- This structure contains detailed information about the change (or other event) that caused the function to be activated.
- Lambda will activate additional copies of function as needed in order to keep pace with changes.
- The functions cannot store durable state on the compute instance and should use S3 or DynamoDB instead.
Node.js & AWS SDK
- Your code can make use of just about any functionality that is intrinsic to Node.js and to the underlying Linux environment.
- It can also use the AWS SDK for JavaScript in Node.js to make calls to other AWS services.
- The context information that you supply for each function specifies a maximum execution time for the function.
- This is typically set fairly low (you can do a lot of work in a couple of seconds) but can be set to up 60 seconds as your needs dictate.
Lambda Runtime Environment
- The context information that you supply for each function specifies a maximum execution time for the function.
- This is typically set fairly low (you can do a lot of work in a couple of seconds) but can be set to up 60 seconds as your needs dictate.
-
Lambda uses multiple IAM roles to manage access to your functions and your AWS resources.
- invocation role gives Lambda permission to run a particular function.
- execution role gives a function permission to access specific AWS resources.
-
You can use distinct roles for each function in order to implement a fine-grained set of permissions.
Analytics Data
-
Lambda monitors the execution of each function and stores request
- count,
- latency,
- availability, and
- error rate metrics in Amazon CloudWatch.
- The metrics are retained for 30 days and can be viewed in the Console.
Memory, CPU, I/O
-
The context information for a function specifies the amount of memory needed to run it.
-
You can set this to any desired value between 128 MB and 1 GB.
-
The memory setting also determines the amount of
-
CPU power,
-
network bandwidth, and
-
I/O bandwidth that are made available to the function.
-
Processes, Storage, Network
- Each invocation of a function can make use of
- up to 256 processes or threads.
- up to 512 MB of local storage
- up to 1,024 file descriptors
- up to 10 simultaneous outbound network connections.
- Lambda imposes a set of administrative limits on each AWS account.
- During the preview, you can have up to 25 invocation requests underway simultaneously.
AWS Lambda
By Harpreet Hira
AWS Lambda
- 693