Serverless 101: Deploying your first AWS Lambda function

Serverless sounds magical: you write a little piece of code, point it at an event, and the cloud runs it for you. In reality, it’s simple plumbing with a tiny bit of ceremony up front. This guide walks you through deploying a “Hello, World” AWS Lambda function, explains the choices you’ll make, and points out a few modern considerations so your first serverless step doesn’t trip you up.

Why this matters

What you need before you begin

Step 1 — Pick where to start: Console vs CLI vs Container For your first function, the Console is fastest: it scaffolds the role and provides a simple editor and test runner. If you prefer local development, AWS SAM or the AWS CLI are the next steps. If you expect heavy dependencies or native libraries, you can package as a container image and push to Amazon ECR — Lambda supports container images as a deployment package type. (docs.aws.amazon.com)

Small tip: when creating a function you’ll choose an architecture (x86_64 or arm64). Arm64 (AWS Graviton) often gives better cost-to-performance for many runtimes and workloads in independent benchmarks — so it’s worth trying if you care about costs or latency. (techradar.com)

Step 2 — Create the function (Console quick steps)

  1. Open the Lambda console and choose “Create function.”
  2. Choose “Author from scratch.” Enter a name (e.g., hello-lambda), pick a runtime (Node.js or Python are beginner-friendly), and choose or create a basic execution role. The console can create a role with the AWSLambdaBasicExecutionRole policy so your function can send logs to CloudWatch. (aws.amazon.com)
  3. Click Create. The console will create the function and display a code editor.

Step 3 — The smallest function (Node.js example) Paste this into the editor (index.js or app.js depending on the template):

exports.handler = async (event) => {
  const name = event?.name || 'world';
  return {
    statusCode: 200,
    body: JSON.stringify({ message: `Hello, ${name}!` })
  };
};

Save, then use the Test button in the console to create a sample event:

{ "name": "Ada" }

Invoke the test and you should see the response and log output in the console.

Step 4 — Understand the role and logs

Key settings to review

Alternatives: ZIP vs Container images

Modern context — what’s new and useful AWS regularly adds features that matter even for beginners:

Debugging checklist (quick)

A few practical UX notes

Wrap up (no extra steps suggested) You’ve just deployed a tiny piece of serverless code and exercised the core loop: create, provide minimal permissions, write a handler, test, and inspect logs. From here, the path forks — you can iterate locally with SAM, swap to a container image, or explore event-driven patterns — but the basic Lambda lifecycle you practiced is the same across those options. Official AWS tutorials and docs are excellent next reads if you want deeper reference material for each path. (aws.amazon.com)

References (selected)

Finished your first function? Think of it like learning a new song on guitar: once you know the basic chord progression (create → attach role → handler → test → logs), you can jam in different styles — tiny acoustic bits (ZIP) or full-band arrangements (containers and advanced runtimes).