Getting Started with Serverless on AWS

What is Serverless?

Serverless computing lets you build and run applications without managing servers. You write your code, deploy it, and the cloud provider handles everything else — scaling, patching, availability.

Despite the name, servers are still involved. You just don’t have to think about them.

Why Serverless?

Three compelling reasons:

  1. Cost efficiency — Pay only for what you use, down to the millisecond
  2. Auto-scaling — From zero to thousands of concurrent requests automatically
  3. Reduced ops — No server maintenance, no capacity planning

Your First Lambda Function

Here’s a simple AWS Lambda function in Node.js:

export const handler = async (event) => {
  const name = event.queryStringParameters?.name || 'World';
  
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: `Hello, ${name}!`,
      timestamp: new Date().toISOString(),
    }),
  };
};

Deploy it with SST:

// sst.config.ts
new sst.aws.Function("HelloWorld", {
  handler: "src/hello.handler",
  url: true,
});

That’s it. You now have a globally accessible API endpoint backed by Lambda.

When NOT to Use Serverless

Serverless isn’t a silver bullet. Avoid it for:

  • Long-running processes — Lambda has a 15-minute timeout
  • Stateful applications — Each invocation starts fresh
  • Predictable, constant workloads — A dedicated server might be cheaper

What’s Next

In the next post, I’ll cover how to build a full REST API with Lambda, API Gateway, and DynamoDB. We’ll also look at local development with SST’s sst dev command.