Cloud computing came through long way by replacing layer after a layer we used bare metal server then Virtual servers then Containers now Serverless computing
Serverless is the next evolution of application and system design and deployment. Serverless applications are built upon functions—small code artifacts, which are compact and specific to a disc
Serverless doesn’t mean servers are no more required to run workloads, it simply means that developers no longer have to think about them, this will make the developers focus more on tasks than servers. Serverless is often called as Function as service
Amazon AWS has FaaS called AWS Lambda
Recently VMware also released its version of serverless computing (VMware Dispatch), you can read more about this here.
AWS Lambda is an ideal compute platform for many application scenarios, provided that you can write your application code in languages supported by AWS Lambda (that is, Node.js, Java, Go and C# and Python), and run within the AWS Lambda standard runtime environment and resources provided by Lambda.
Nowadays many Cloud-based apps require to wake up and execute some process when triggered by external events. e.g in case of my blog table updates send an email newsletter to subscribers. likewise, we can trigger based on events.
AWS Lambda is different from the EC2 instance and EC2 containers yet another PaaS ( Instance ) or Docker like container ( ECS) needs a developer to maintain the lifecycle in other hands Lambda is more simple and can invoke on events.
Lambda can be used for many purposes like
- The developer writing event-driven applications which integrates seamlessly with other AWS services.
- A function to run on specified time
- Analytics / Auditing on logs
Some of the Events which can trigger a Lambda functions:
- Table updates on Amazon DynamoDB
- Event from mobile/web application through hooks by web services using API gateway
- Notification send from Amazon SNS Topic
- Trigger form IoT rule / IoT button
- Object Created/ updated /removed from Amazon S3 bucket.
- Any code commit events like Push, update branch or tags
- Periodic schedule
Lambda offers zero administration compute platform so developers not to worry about dealing EC2 instances. Functions are written in GO, Java 8, Node, Python, C# ( AWS Lambda Supports Microsoft.NET Applications) is uploaded and specify execution instruction, role, Memory and timeout settings in case you need to connect to AWS service in VPC you can choose the VPC in the network section. all set.Lambda will automatically run code on the configured event.
Pricing
Amazon bills users based on the number of requests served and the compute time needed to run the code, metered in increments of 100 milliseconds. If a function is never called, it costs the developer nothing. AWS Lambda is available with a free tier of service that includes one million free requests and 400,000 gigabyte-seconds of computing time per month.
Sample program on AWS Lambda to delete old snapshots by schedule trigger