Nowadays microservices are more popular. The tool to adopt and write microservices with AWS is the lambda function. AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. With AWS Lambda, you can run code for virtually any type of application or backend service - all with zero administration. The real key thing with AWS lambda is it cost only when it runs.
Feature Of AWS Lambda :
- Provisioning and capacity of the compute fleet that offers a balance of memory, CPU, network, and other resources.
- Maintenance of servers and OS
- High availability and automatic scaling.
- Monitoring fleet health
- Applying security patches
- Deploying your code
- Managing and logging your lambda functions
- Runs your code on a high availability compute infrastructure.
- Executes code only when needed and scales automatically from a few requests per day to thousands per second.
- Need to pay only for compute time that developer’s code consumes - no extra charge when code is not running.
While using AWS lambda all you need to supply your code in the form of one or more Lambda functions to AWS lambda, in one of the programming languages that AWS Lambda supports. Currently, AWS lambda supports Node.js, Java, PowerShell, C#, Ruby, Python and Go. And the service can run the code on your behalf.
AWS Lambda manages lots of things for you but in case if you want control over resources then EC2, Elastic beanstalk tools are more suitable. Here you get more customization options.
How does AWS Lambda works ?
Clients sends data to AWS lambda, these clients could be anyone sending requests to AWS lambda like application or other Amazon services. Depending on the volume of this data AWS lambda runs on different containers (AWS Lambda supports container images as a packaging format. You can now package and deploy AWS Lambda functions as a container image of up to 10 GB. This makes it easy to build Lambda based applications using familiar container tooling, workflows, and dependencies) .Resource allocation and number of containers required depends upon data size and computational requirement to execute function, and these are handled by AWS Lambda. Post execution AWS lambda return result to caller or to connected service.