What is serverless computing?

Serverless computing is an application development model where you can build and deploy applications on third-party managed server infrastructure. All applications require servers to run. But in the serverless model, a cloud provider manages the routine work; they provision, scale, and maintain the underlying infrastructure. The cloud provider handles several tasks, such as operating system management, security patches, file system and capacity management, load balancing, monitoring, and logging. As a result, your developers can focus on application design and still receive the benefits of cost-effective, efficient, and massively scalable server infrastructure.

Why is serverless computing important?

In the early days of the internet, anyone wanting to run a web application had to purchase and maintain physical servers. Companies would typically store their physical server devices in on-premises data centers or co-location facilities. This could be expensive, as most applications only used a very small fraction of server hardware resources.

The cloud computing model initially solved this problem by allowing customers to create virtual servers or instances on cloud provider hardware. However, customers still had to provision, configure, update, and scale their virtual servers.

In response to these issues, cloud providers began offering serverless technologies to increase agility and optimize costs even further. With serverless computing, your developers can run code, manage data, and integrate applications without worrying about infrastructure management tasks.

There are several benefits of serverless adoption, which we outline next.

Increased developer productivity

Your development teams can focus on building applications instead of configuring them. Lower operational overheads mean your applications get to market faster. Your developers can respond to customer feedback and frequently release application code changes.

Efficient scalability

Cloud vendors provide an automatic scaling feature in their serverless environments. Your serverless applications scale automatically from zero to peak demand. Your developers don't have to think about usage while writing code.

Lower costs

You only pay for the CPU, memory, and other computing resources required when your code runs. You pay nothing for idle resources. This pay-for-value billing model ensures optimum resource utilization and no wastage from over-provisioning.

What are the use cases of serverless computing?

There are many applications and systems where serverless computing can be useful.

Stateless application development

Serverless architecture is ideal for asynchronous, stateless applications that do not save client data between sessions. Examples of serverless applications include chatbots, task schedulers, and IoT applications. For instance, Coca-Cola used AWS developed a mobile pouring app for its touchless drink dispenser in just 100 days. Coca-Cola used serverless building blocks like AWS Lambda.

Batch processing

Batch processing applications periodically complete high-volume, repetitive data jobs such as backups, filtering, and sorting. Batch processing is well-suited for serverless environments that scale massively when needed and cost nothing when unused.

For example, Liberty Mutual used AWS to consolidate its disparate global lines of business into a centralized system called Financial Central Services (FCS). It used AWS Step Functions to create a serverless application that can process 100 million transactions in one run at the end of every month.

Real-time data analytics

Serverless computing is ideal for real-time streaming engines to improve customer responsiveness. Serverless apps can handle vast amounts of streaming data from hundreds of thousands of sources while experiencing low latency and high bandwidth. As a result, you can derive insights in seconds instead of minutes.

For example, Genentech uses AWS serverless functionality for clinical data analysis. Researchers can now complete tasks in a few hours that would previously take weeks to run.

Business process automation

You can use the serverless approach to automate business processes that are tedious and time-consuming. Your developers can focus on translating business logic to application code without managing servers.

For example, Taco Bell used AWS to create serverless applications to perform business logic and data transformations. These delivered real-time menu and restaurant information to Taco Bell's delivery partners. Serverless investments helped the brand shift rapidly to meet consumer demand for delivery during the COVID-19 pandemic.

How does serverless architecture work?

Any application has two broad areas of functionality—the frontend and the backend. The frontend includes everything your end users interact with—such as the visual layout, buttons, and display text. The backend includes functionality that your users can't access, like data storage and processing.

For example, consider a flight booking app on your mobile device. The frontend is your application UI, where you can choose dates and request a list of flights available. Your request goes to the backend, which looks up the database and returns information about all the flights available in your chosen timeframe. The following diagram shows the traditional architecture.

Traditional web application framework diagram

In serverless architecture, developers deploy backend code in the cloud infrastructure provided by the cloud providers. The key to serverless applications is event-driven architecture—a modern architecture pattern built from small, decoupled services that publish, consume, or route events. Events are messages sent between services.

This architecture makes it easier to scale, update, and independently deploy separate components of a system. The following diagram shows an event-driven serverless microservice.

Event-driven serverless microservice diagram

Next, we give an overview of how serverless architecture works.

Functions

Functions are small, discrete code units that perform a single task. A function requires compute resources like CPU and memory to run. The cloud provider allocates these resources only when required. It creates a temporary environment for the serverless function to run.

Certain events can trigger or make the code unit run. For example, an event could run if a user selects a button in an application. The request would trigger a function that reads the database and returns the relevant information to the user.

Scaling requests

The more requests a function receives, the more resources it needs to run. The serverless platform monitors the load and keeps allocating cloud resources to a near-infinite scale. A single serverless function can thus handle one or one million requests without code changes.

Once a function stops receiving requests, the cloud provider takes down the associated infrastructure to save on cost. It allocates resources only when required. If there's no usage, the environment can scale to zero.

What are the types of serverless architecture?

In serverless architecture, the cloud provider manages several small and big backend tasks for your application. You can deploy custom code; the cloud provider will dynamically allocate resources whenever your code runs. The cloud platform may also provide backend functionality that you can use directly without writing code from scratch.

We explain both types of serverless architectures next.

Function as a service

Function as a service (FaaS) is a serverless architecture that developers can use to write custom backend functions and deploy the function code directly to the cloud infrastructure. When a function is called, the cloud provider runs the function on an existing active server or spins up a new server if required. Such functions are called serverless functions because their execution process is abstracted away from developers. Developers can write and deploy code without worrying about how and where it runs.

Backend as a service

Backend as a service (BaaS) gives developers access to backend functions using an API. APIs are mechanisms that enable two software components to communicate with each other using a set of definitions and protocols.

In their serverless environment, cloud vendors give API-based access to extra encryption, authentication, and cloud-accessible databases. They can also provide access to other third-party services and applications. These serverless functions are prewritten and can be called directly in the code.

What is the serverless-first strategy?

Serverless architecture is recognized by the following tenets:

  • No server management
  • Pay-for-value services
  • Continuous scaling
  • Built-in fault tolerance

A serverless-first strategy prioritizes these tenets throughout an organization's applications, operations, and development cycles. A serverless developer or serverless-first company works to build using these tenets first and foremost.

But serverless computing isn't suitable for every workload. You can incorporate non-serverless technologies as supporting architecture as you need.

Is serverless architecture secure?

Most cloud vendors adopt a shared security model. The cloud provider is responsible for the security of the cloud, while customers are responsible for security in the cloud.

With serverless, the cloud provider manages many additional infrastructure layers, including operating systems and networking. Customers must follow the principles of least privilege and the best practices of securing a serverless application.

For example, in AWS FaaS solutions like AWS Lambda, you can secure each resource with granular permissions using familiar tools like AWS IAM Identity Center. This can help give you a robust security posture for your serverless applications.

How can AWS support your serverless computing requirements?

Amazon Web Services (AWS) has many offerings to support your serverless computing.

Serverless on AWS details technologies you can use to run code, manage data, and integrate applications without managing servers. With AWS serverless technology, you get automatic scaling, built-in high availability, and a pay-for-use billing model to increase agility and optimize costs. These technologies also eliminate infrastructure management tasks like capacity provisioning and patching, so you can focus on writing code that serves your customers. 

Serverless applications start with AWS Lambda, an event-driven compute service natively integrated with more than 200 AWS services. We also have a large number of additional supporting services, like these:

Get started with serverless on AWS by creating an account today.

Next Steps on AWS

Sign up for a free account

Instant get access to the AWS Free Tier.

Sign up 
Start building in the console

Get started building in the AWS management console.

Sign in