We have taken reference of Azure Functions for explaining Serverless Event driven cloud functions. Other popular serverless functions include ASW Lambda, Google Cloud Functions, & IBM Cloud Functions. Most of them share quite similar architecture and working pattern.
Introduction
Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running. You focus on the code that matters most to you, in the most productive language for you, and Azure Functions handles the rest.
We often build systems to react to a series of critical events. Whether you’re building a web API, responding to database changes, processing IoT data streams, or even managing message queues – every application needs a way to run some code as these events occur.
To meet this need, Azure Functions provides “compute on-demand” in two significant ways.
- First, Azure Functions allows you to implement your system’s logic into readily available blocks of code. These code blocks are called “functions”. Different functions can run anytime you need to respond to critical events.
- Second, as requests increase, Azure Functions meets the demand with as many resources and function instances as necessary – but only while needed. As requests fall, any extra resources and application instances drop off automatically.
Scenarios
In many cases, a function integrates with an array of cloud services to provide feature-rich implementations.
The following are a common, but by no means exhaustive, set of scenarios for Azure Functions.
If you want to… | then… |
---|---|
Build a web API | Implement an endpoint for your web applications using the HTTP trigger |
Process file uploads | Run code when a file is uploaded or changed in blob storage |
Build a serverless workflow | Create an event-driven workflow from a series of functions using durable functions |
Respond to database changes | Run custom logic when a document is created or updated in Azure Cosmos DB |
Run scheduled tasks | Execute code on pre-defined timed intervals |
Create reliable message queue systems | Process message queues using Queue Storage, Service Bus, or Event Hubs |
Analyze IoT data streams | Collect and process data from IoT devices |
Process data in real time | Use Functions and SignalR to respond to data in the moment |
These scenarios allow you to build event-driven systems using modern architectural patterns.
As you build your functions, you have the following options and resources available:
- Use your preferred language: Write functions in C#, Java, JavaScript, PowerShell, or Python, or use a custom handler to use virtually any other language.
- Automate deployment: From a tools-based approach to using external pipelines, there’s a myriad of deployment options available.
- Troubleshoot a function: Use monitoring tools and testing strategies to gain insights into your apps.
- Flexible pricing options: With the Consumption plan, you only pay while your functions are running, while the Premium and App Service plans offer features for specialized needs.