CLOUD CONCEPT

Serverless

Serverless is a cloud operating model in which the provider manages the underlying servers while customers deploy applications or use services without provisioning and maintaining those servers.

Cloud Concepts Hub →

What is Serverless

Serverless shifts infrastructure operations to the cloud provider so engineers can focus on application behavior, data, and configuration. It can reduce operational work and align costs with usage, but scaling behavior, billing, execution limits, and customer responsibilities vary by service.

Serverless describes how infrastructure is operated, not the absence of servers. Physical and virtual servers still execute the workload, but the cloud provider manages their provisioning, maintenance, and replacement. Customers work with higher-level resources such as functions, container tasks, APIs, queues, and databases instead of administering individual hosts. The practical benefit is less infrastructure management, particularly for teams building applications with variable demand.

Serverless is broader than function as a service. Functions are one implementation, but managed container execution and services for messaging, storage, and workflow orchestration also apply the model. Conversely, running an application in a container does not automatically make it serverless. If the team must provision and patch the container hosts, it still manages server infrastructure.

AWS Lambda is appropriate for event-driven functions, such as processing an uploaded image, responding to an API request, or handling messages from a queue. AWS provisions execution environments and scales function execution within configured limits and service quotas. Each invocation has a maximum execution duration of 15 minutes, making Lambda unsuitable for a single uninterrupted job that must run longer. Functions can be packaged as container images, but they still follow Lambda's execution model rather than behaving like continuously running container services.

AWS Fargate is appropriate when an application should run as containers without managing the underlying compute instances. It supplies compute for Amazon ECS tasks and Amazon EKS pods. Examples include a continuously running web service, an existing containerized application, or a batch worker that needs longer execution than a function allows. Engineers still define container images, CPU and memory requirements, networking, permissions, and workload scaling. Fargate does not automatically determine how many application replicas are needed; scaling must be configured through the relevant orchestration mechanisms.

Consider an order-processing application. An API accepts an order and places a message on a managed queue. A Lambda function processes short tasks, while a Fargate task handles a lengthy document-generation job. A managed database stores order status. Durable state belongs in external storage because execution environments can be replaced, and local files should not be treated as durable shared storage. Where event delivery or retries can produce duplicates, handlers should be idempotent so repeated processing does not create duplicate charges or orders.

Serverless does not mean unlimited scaling, guaranteed zero idle cost, or automatic cost savings. Quotas, concurrency settings, database capacity, and downstream dependencies can restrict throughput. Some services can scale to zero, while continuously running containers and reserved execution capacity still incur charges. Compare total costs, including requests, execution time, provisioned resources, networking, logs, and supporting services. Steady, highly utilized workloads may be less expensive on other compute models.

The trade-offs include reduced host-level control, service-specific interfaces, startup latency, and more distributed troubleshooting. Teams must still secure application code, dependencies, identities, data, and configuration. They also need monitoring, retry policies, failure handling, and deployment controls. For exam scenarios, choose Lambda for short event-driven function execution and Fargate for container workloads that need managed compute without host administration; do not assume that every serverless option has the same scaling or billing behavior.

Key aspects of Serverless

Serverless removes server administration while preserving the need to design for workload fit, scaling limits, security, reliability, and cost.

Provider-managed infrastructure

The provider provisions and maintains the underlying servers. Engineers configure application-level resources instead of managing host operating systems and instance fleets.

Multiple execution models

Serverless includes functions, managed container execution, and supporting application services. Choose the model according to execution duration, packaging, runtime requirements, and operational needs.

Service-specific elasticity

Many serverless services adjust capacity to demand, but scaling remains subject to quotas and configuration. Container workloads may require explicit replica-scaling policies, and downstream systems must tolerate increased traffic.

Usage-oriented billing

Charges commonly reflect requests, execution duration, consumed capacity, or allocated resources. Scale-to-zero and zero idle compute charges are not universal properties, so evaluate each service's billing model.

Resilient application design

Store durable state outside replaceable execution environments. Use idempotent processing, bounded retries, and failure destinations or dead-letter queues where appropriate.

Shared security and operational responsibility

The provider manages infrastructure, but customers remain responsible for application security, permissions, data protection, and configuration. Monitoring, dependency updates, and cost controls are still necessary.

Cloud services for Serverless

Amazon API Gateway can expose an API backed by AWS Lambda, while Amazon DynamoDB stores durable application state. Amazon SQS buffers background work so request handling does not depend on immediate completion of every task. Lambda can process short queue-driven operations, while AWS Fargate can run containerized workers or services that need longer execution or different runtime behavior. These services remove host administration, but engineers still configure permissions, retries, scaling limits, and monitoring. Queue consumers should tolerate duplicate delivery where applicable, and their throughput should be controlled to avoid overwhelming the database or other downstream dependencies.

AWS Lambda image AWS Lambda

Runs functions without requiring customers to provision or maintain execution hosts. It suits API handlers, scheduled automation, and event processing, with a maximum execution duration of 15 minutes per invocation.

Open AWS Lambda →
AWS Fargate image AWS Fargate

Provides serverless compute for Amazon ECS tasks and Amazon EKS pods. It suits containerized services and jobs that need container-level packaging or longer execution, while customers configure resource requirements and workload scaling.

Open AWS Fargate →
Amazon API Gateway image Amazon API Gateway

Provides managed API endpoints without requiring customers to operate API server infrastructure. It can route requests to Lambda and other backends, with authentication and throttling capabilities depending on the API type.

Open Amazon API Gateway →
Amazon DynamoDB image Amazon DynamoDB

Provides a serverless NoSQL database for durable application state without database server administration. On-demand capacity accommodates variable request traffic, while provisioned capacity offers explicitly configured throughput with optional automatic scaling.

Open Amazon DynamoDB →