Chapter 93: AWS Lambda and Serverless for DevOps
93.1 Why serverless — a function instead of an always-on server
Story (fictional teaching scenario). Priya in Pune and Elena in Lisbon run a fictional ticket shop. Their price calculator is busy for ten seconds after each sale, then idle. They do not want a VM running only to wait. They consider Lambda for the small calculation, but keep the long-running video worker in a container.
Why
You should choose the running model after you know the job. Small event-driven work can avoid managing an always-on application server.
What
- Serverless means AWS manages the underlying servers. Servers still exist; you still own code, access rules, data protection and costs.
- Function is a small program that starts when work arrives.
- Event is the input describing that work, usually a JSON object.
- Invocation is one request to run the function. It may succeed or fail.
How
-
Describe one short job, not the whole company system.
-
Choose an event shape.
-
Calculate the result without a running web server.
Example 1: One order calculation
- Read the input and the code.
{"qty":3,"unit_paise":4000}
- Read the result.
Output (illustrative; not executed on AWS)
{"total_paise":12000,"currency":"INR"}
- What each part means:
qtyis three items.unit_paiseis ₹40 in integer paise. Multiplication gives 12000 paise, or ₹120. One such request is one invocation. USD prices could likewise use integer cents. This is not an AWS price quote.
Ravindra Bagale's Tip
Serverless removes server administration, not responsibility.
Serverless मुळे server सांभाळायचं काम कमी होतं, जबाबदारी नाही.
Serverless से server का काम कम होता है, जिम्मेदारी नहीं.
Did you understand? Let us try it once more.