AWS Lamda is a serverless event driven compute service.
How AWS Lamda Works:
- First you need to upload your code to lamda in one or more lamda functions.
- AWS Lamda then execute the code in your behalf.
- After the code is invocked, lamda automatically take care of provisiining and maaging the requared servers.
Important terms used in Lamda:
- Function: A function is a resource that you can invoke to run your code in AWS Lamda. A function has code that process events, and a runtime that passes events and a runtime that passes request and responses between lamda and the function.
- Runtime: Lamda Runtime allows functions in different languages to run in the same base execution environment. The runtime sits in between the lamda function code, relaing invocation events, context, information and responses between the two.
- Events: It is a JSON document that contians data for a function to process.
- Events Source/Trigger: An AWS service such as amazon SNS or a custom service that triger your functions and executes it logic.
- Downstream Resoures: An AWS service that your lamda function calls once it gets triggered.
- Concurrency: Number of request that your function is serving in any given time. (MAX 1000 request can run a time)
Example of AWS Lamda with S3.
- The user create an object in a bucket.
- Amazon S3 detects the oject created event.
- Amazon S3 envokes your lamda functions using the permission provided by the executes on role.
- Amazon S3 knows which lamda function to invoke based on the bucket notification configuration.
AWS Lamda function configuration
- A lamda function consists of code and any associated dependencies.
- In addition a lamda funciton also configuration information associated with it.
- Initially, you specify the configuration information when you create a lamda function.
- Lamda provides and API for you to update some of the configuration data.
Maximum Execution Timeout
- You have to pay for the resources that are used to run your lamda function.
- To prevent your lamda function from running indefinitely, you specify a timeout.
- When you specify timeout is reached, AWS Lamda terminates your lamda funciton.
- By default the execution time is 3 seconds and maximum is 900 seconds (15 minutes).
Tags: AWS StorageL2DLearn2Done