Working with event-driven compute resources

Businesses can unshackle themselves from the woes of traditional IT surrounding applications, and provide on-demand resources from the cloud.

Many applications consume computing resources continuously, yet perform useful work only when specific events occur. Organizations are picking up on this inherent wastefulness and doing something new.

Enter event-driven computing, which seeks to improve efficiency by loading and running applications only in response to real-world events -- only long enough to address the needs of that event -- then dismissing the application to free the underlying infrastructure resources for other tasks.

How event-driven compute works

The underlying issue here is computing efficiency -- getting maximum business benefit from minimum IT resources and costs.

Consider a traditional data center. A business would typically invest in the physical servers, operating systems and application licenses. The application, such as a database, web server or order entry system, would run continuously regardless of how much it's actually used, and the business winds up owning and maintaining the server, storage, network and other infrastructure needed to make that application work.

Cloud computing changes this traditional model by allowing a company to deploy, operate and scale applications without making any capital investments in infrastructure. The IT team adds or removes servers or storage as needed. Businesses can power down the application whenever it's not needed, or even retire the application without ever worrying about redeploying the hardware. While cloud computing demonstrates potential economic advantages, the application still runs and consumes computing resources that demand provisioning and managing services with a cloud provider.

But what if a business application or task only runs when it's actually doing something useful or triggered by an external event -- and then stops running again? This is the basic premise that spurred event-driven compute. Application code is uploaded to a cloud provider and configured to execute when one or more conditions occur. The code is typically written in a common language such as Node.js, Java or Python. The code is loaded and executed only when it's triggered -- using just enough compute resources to accomplish the task -- and then the code is unloaded until it is needed later. The business only pays for the computing time or resources that are actually used to address the triggered events.

Other cloud services, changes in data, changes in system states and even user actions can generate events. For example, a business needs to automatically resize and crop images uploaded to a cloud storage platform. With event-driven compute in place, the image upload triggers the edit task; it stops again after the editing completes. Event-driven computing can also tackle data processing and transformation tasks, among others.

Compute-invoking events

Event-driven computing relies on the availability of defined events to trigger the execution of associated application code. The cloud provider typically defines events for their specific brand of event-driven compute, but there are several general categories.

The broadest and most common source of triggered events comes from the cloud provider's stable of services, such as computing instances, storage instances, database instances and streaming services. For example, Amazon Cognito can use a Sync Trigger event to trigger an AWS Lambda function when a data set is synchronized, or Amazon Simple Email Service can call a Lambda function when messages arrive.

The main event

The terms event and trigger are both used to describe the code that sets off an action in event-driven compute platforms. Depending on the platform or provider, expect to see them used interchangeably.

An event can usually be triggered on-demand, either in direct response to a user's action or in response to the application code that is running. External events can trigger a response, via an application programming interface gateway. Similarly, developers can elect to trigger some events at a regular rate, such as hourly or daily, to initiate housekeeping tasks like backups or log pruning.

Management events can trigger actions as well. Cloud providers typically offer a monitoring and management service, and the same reporting and alerting behaviors that keep administrators informed of important occurrences can also trigger associated events. For example, Amazon CloudWatch Events can serve to trigger AWS Lambda functions.

Events can also trigger other cloud services. For example, an event can trigger actions in a cloud provider's database service, or invoke additional compute instances to scale up resources for other applications.

 Event-driven computing does not replace all application deployment models. There is always a place for traditional, full-time applications, but the rise in event-driven computing offers developers a powerful new tool to address tasks that may only need to be accomplished in response to infrequent real-world conditions.

Next Steps

Inside AWS Lambda's event-driven capability

Serverless, event-driven and NoOps -- Oh my!

Cloud vendors flaunt their event-driven wares

Consider how to monitor a serverless app

Dig Deeper on Managing Cloud-Native Applications