Skip to content
AWS aws serverless 5 min read

What is Serverless?

Serverless is a way of building applications where you write code and AWS runs it for you, without you ever launching, patching, or sizing a server. You hand AWS a small unit of work (a function, a queue, a table) and AWS handles where it runs, how many copies run, and when to turn them off. You pay only for what you actually use, often down to the millisecond. This matters because it removes a huge amount of routine operations work and lets a small team ship and scale fast.

What “serverless” really means

Serverless does not mean there are no servers. There absolutely are servers, lots of them, running in Amazon’s data centers. The word “serverless” means you do not see, choose, or manage those servers. AWS owns that layer completely.

Three ideas define serverless:

  • No server management. You never SSH (Secure Shell, a way to log into a machine) into anything, never apply OS (operating system) patches, and never size a fleet. There is no instance to keep alive.
  • Automatic scaling. When 1 request arrives, AWS runs 1 copy. When 10,000 arrive at once, AWS runs many copies in parallel. When traffic drops to zero, it scales down to zero, and you stop paying.
  • Pay-per-use. You are billed for actual execution (for example, requests handled and milliseconds of compute used), not for idle servers sitting on standby.

The big trade-off: serverless trades operational control for managed scaling. You give up the ability to tune the host, install custom kernels, or keep a long-lived process warm. In exchange, AWS handles capacity, availability, and scaling for you.

The core AWS serverless services

Serverless is not one product; it is a family of managed services you wire together. These are the building blocks you will use most.

ServiceWhat it isCommon job
AWS LambdaRuns your code in response to eventsBusiness logic, glue code, APIs
Amazon API GatewayA managed front door for HTTP APIsTurn a Lambda into a public REST/HTTP endpoint
Amazon DynamoDBA managed NoSQL (non-relational) databaseStore and read app data at any scale
Amazon SQSSimple Queue Service, a managed message queueBuffer work so producers and consumers decouple
Amazon EventBridgeA managed event busRoute events between services by rules
AWS Step FunctionsA managed workflow engineCoordinate many steps into one reliable flow

A typical serverless app looks like this: a request hits API Gateway, which invokes a Lambda function, which reads and writes DynamoDB, and drops a message on SQS for slower background work. EventBridge routes events between features, and Step Functions orchestrates anything multi-step. None of these require you to run a server.

A first taste: create a Lambda function

The smallest possible serverless app is one Lambda function. Here is how to create one both ways.

In the AWS Management Console:

  1. Open the Lambda console and choose Create function.
  2. Select Author from scratch.
  3. Give it a name like hello-serverless.
  4. Choose a runtime (the language stack), for example Node.js 22.x or Python 3.13.
  5. Click Create function, then paste your code in the inline editor and choose Deploy.

The equivalent with the AWS CLI (Command Line Interface) v2. First zip your code, then create the function (the --role is an IAM execution role, the permissions the function runs with):

zip function.zip index.mjs

aws lambda create-function \
  --function-name hello-serverless \
  --runtime nodejs22.x \
  --handler index.handler \
  --zip-file fileb://function.zip \
  --role arn:aws:iam::123456789012:role/lambda-basic-exec

Output:

{
    "FunctionName": "hello-serverless",
    "FunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:hello-serverless",
    "Runtime": "nodejs22.x",
    "Handler": "index.handler",
    "State": "Pending",
    "PackageType": "Zip"
}

That is a full serverless deployment. There is no instance ID, no security group, no disk to manage. AWS will run it on demand and scale it for you.

When to use serverless (and when not to)

Use serverless when:

  • Your traffic is spiky or unpredictable, so paying per-request beats paying for idle servers.
  • You want minimal operations and a small team, with no patching or fleet management.
  • The work is event-driven: respond to an upload, a queue message, a schedule, or an HTTP call.
  • You are building a new feature fast and want to scale to zero when nobody is using it.

Avoid or reconsider serverless when:

  • You have steady, high-volume, always-on traffic. At sustained high load, a fixed t3.medium EC2 (Elastic Compute Cloud) instance running 24/7 can be cheaper than millions of paid invocations.
  • You need very long-running jobs. Lambda caps a single run at 15 minutes.
  • You need predictable low latency with no cold starts (the small delay when AWS spins up a fresh copy of an idle function).
  • You depend on special hardware, custom OS tuning, or large local state on disk.

Cost gotcha: “serverless = cheaper” is a myth. Serverless is cheapest when load is variable and often idle. A function handling 200 requests per second every second of the day may cost more than one small always-on EC2 box doing the same work. Always model your real traffic before assuming it saves money.

Serverless vs always-on servers

Serverless (Lambda)Always-on (EC2)
You manageJust your codeOS, patches, scaling, the instance
ScalingAutomatic, to zeroManual or Auto Scaling groups
BillingPer request + per msPer second the instance runs
Idle costNoneYou pay even at 0 traffic
Best forSpiky, event-driven workSteady, high-volume workloads

Best practices

  • Keep functions small and single-purpose. One function, one job, makes scaling and debugging far easier.
  • Make handlers stateless. Store state in DynamoDB or S3 (Simple Storage Service), never on the function’s local disk, because copies are temporary.
  • Set sensible timeouts and memory. Right-sizing memory also tunes CPU and directly affects both speed and cost.
  • Decouple with queues and events. Put SQS or EventBridge between components so a slow or failing consumer never blocks the producer.
  • Model your cost before committing. Estimate real request volume and compare against a small EC2 instance for sustained load.
  • Grant least privilege. Give each function an IAM role with only the permissions it needs, nothing more.
  • Watch cold starts. For latency-sensitive paths, keep packages small and consider provisioned concurrency.
Last updated June 15, 2026
Was this helpful?