AWS Lambda
AWS Lambda
AWS Lambda -
- AWS Lamda let you run a code as functions without provisioning or managing servers
- Lamda based applications are composed of functions triggered by events
- With serverless computing your application still run on servers but all the server management is done by AWS
- You cannot log into compute instances that run lamda function or customize the operating system or language runtime
Features of AWS Lamda -
- Auto Scaling and High Availability - AWS lamda will make sure that your application was highly available to the end users when there is sudden incoming traffic. Highly available can be achieved by scaling the application
- Serverless Execution - there is no need for provisioning the servers manually in AWS. AWS will lamda will provision the underlying infrastructure based on the triggers you are mentioned whenevr a new file is uploaded to a particular then AWS lamda will automatically trigger and takes care of the infastructure
- Pay-Per-Use-Pricing - AWS will charge you only for the time that time compute engine was active. AWS bills you based on the time taken to execute the code.
- Supports Different Programing languauge - AWS lamda function will support different programming languages. You can build the function with the language at your convenience.
- Integrates With Other AWS Sevice - AWS lamda can be integrated with different AWS service like the following -
- API Gateway
- DynamoDB
- S3
- Step Functions
- SNS
- SQS.
- Versioning and Deployment - AWS lamda function will maintain the different kinds of version of the code of which you can change between the versions without any disruptions based on the application performances
- Security and Identy Management - AWS lamda will leverage AWS IAM to control acce3ss to the function which are built by using lamda. You can define fine grained permissions and policies to secure your functions and ensure that only authorizedd entities can invoke them
AWS Lamda Limits -
- Memory - minimum 128 mb, maximum 10,240 mb in increments
- Epherical disk capacity (/tmp space) per inovocation - 512 mb
- Size of environment variables maximum 4kb
- No. of file descriptors - 1024
- Maximum execution duration per request - 900 sec (15mins)
- Lamda function deployment size 50mb(zipped), 250mb(unzipped)
How Does AWS Lamda Works ? -
- Start off by uploading the code to AWS Lamda
- From there set up the code to trigger from other AWS service, HTTP endpoints, or mobile apps
- AWS lamda will only run the code when its triggered and will also use the computing resources meeded to run it.
- The user has to play only for the compute time used
Lamda Layers -
- You can configure your lamda function to pull in additional code and content in the form of layers
- A layer is a zip archieve that contains libraries, a custom runtime, or other dependancies
- With layers, you can use libraries in your function without needing to include them in your deployment package.
- A fucntion can use upto 5 layers at a time.
- Layers are extracted to the /opt directory in the function execution environment
- Each runtime looks for libraries in a different location under /opt , depending on the language
Lamda Handler -
- A handle is a function which lamda will invoke to execute your code - it is an entrypoint
- When you create a lamda function, you specify a handler that AWS lamda can invoke the service executes the function on your behalf
- You define a lamda function a handler as an instance or static method in a class
Lamda@edge -
- Lamda@edge allows you to run code across AWS locations globally without provisioning or managing servers, responding to end users at the lowest network latency
- Lamda@edge lets you run Node.js and python lamda functions to customize content that Cloudfront delivers, executing the functions in AWS locations closer to the viewer.
- The functions run in response to CloudFront events, without provisioning or managing servers. You can use lamda functions to change Cloudfront request and responses at the following points -
- After Cloudfront receives a request from viewer (viewer request)
- Before Cloudfront forwards the request to the origin (origin request)
- After Cloudfront recieves the response from the origin (origin response)
- Before Cloudfront forwards the response to the viewer (viewer response)
- -
- You just upload your Node.js code to AWS lamda and configure your function to be triggered in response to an Amazon Cloudfront Request
- The code is then ready to execute across AWS location globally when a request for content is recieved, and scales with the volume of Cloudfront requests globally
Use Cases Of AWS Lamda -
- File Processing - AWS lamda can be triggered by using S3. Whenever files are added to the S3 service lamda data processing will be triggered
- Web Application - You can combine both web applications and AWS lamda which will scale up and down automatically based on the incoming traffic
- IoT Applications - You can trigger the AWS lamda based on certain conditions while processing the data from the device which are connected to the IoT application. it will analyze the data which are recieved from the IoT application
- Steam Processing - Lamda functions can be integrated with the Amazon kinesis to proecess real time streaming data for application tracking, log filtering and so on
Charges -
Price based on
- Number of requests
- Duration of request from the time your code begins execution until it returns or terminates
- The amount of memory allocated to the function
Comments
Post a Comment