Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

aws-lambda

FreeNo executable scriptsNot checked

AWS Lambda runs your code on demand without servers, scaling from zero to thousands of concurrent executions and billing per invocation. Use this skill to…

TerminalSkillsby TerminalSkills★ 221 GitHub stars17 installs in other catalogs

About this skill

AWS Lambda — Serverless Functions

Overview

AWS Lambda runs a function in response to an event: an HTTP request through API Gateway or a Function URL, an S3 upload, an SQS message, a DynamoDB stream record or a schedule. You deploy code, Lambda provisions and scales the execution environments, and you pay per request and per millisecond of duration. AWS SAM (Serverless Application Model) is the usual way to describe and deploy functions as CloudFormation.

Check the runtime identifier before you write a template: AWS retires runtimes on a published schedule (Node.js 20 and older are already deprecated; see the Lambda runtimes page). As of October 2026 use nodejs22.x or nodejs24.x, python3.12 to python3.14, java21 or java25, dotnet10. Go and Rust run on the provided.al2023 OS-only runtime.

Instructions

Function handlers

The handler below is for an HTTP API (API Gateway payload format 2.0): the method is in event.requestContext.http.method, not event.httpMethod. The AWS SDK for JavaScript v3 is bundled in the Node.js 22+ runtimes, so the DynamoDB client needs no packaging.

// src/handler.ts: HTTP API (payload 2.0) -> DynamoDB
import { randomUUID } from "node:crypto";
import type { APIGatewayProxyHandlerV2 } from "aws-lambda";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, GetCommand, PutCommand, ScanCommand } from "@aws-sdk/lib-dynamodb";

const db = DynamoDBDocumentClient.from(new DynamoDBClient({}));  // created once per execution environment
const TableName = process.env.TABLE_NAME!;

const json = (statusCode: number, data: unknown) => ({
  statusCode,
  headers: { "content-type": "application/json" },
  body: JSON.stringify(data),
});

export const handler: APIGatewayProxyHandlerV2 = async (event) => {
  try {
    switch (event.requestContext.http.method) {
      case "GET": {
        const id = event.pathParameters?.id;
        if (id) {
          const { Item } = await db.send(new GetCommand({ TableName, Key: { id } }));
          return Item ? json(200, Item) : json(404, { error: "Not found" });
        }
        const { Items } = await db.send(new ScanCommand({ TableName, Limit: 50 }));
        return json(200, Items ?? []);
      }
      case "POST": {
        const data = JSON.parse(event.body ?? "{}");
        const id = randomUUID();
        await db.send(new PutCommand({ TableName, Item: { id, ...data } }));
        return json(201, { id });
      }
      default:
        return json(405, { error: "Method not allowed" });
    }
  } catch (error) {
    console.error(error);
    return json(500, { error: "Internal error" });
  }
};

Build it with esbuild (SAM does this for you when the template sets Metadata: BuildMethod: esbuild, see below). Install types with npm i -D @types/aws-lambda esbuild typescript.

# handler.py: S3 event trigger (Python)
import io
from urllib.parse import unquote_plus

import boto3
from PIL import Image  # not in the runtime: list Pillow in requirements.txt

s3 = boto3.client("s3")

def handler(event, context):
    """Create a 300px JPEG thumbnail for each object uploaded under uploads/."""
    for record in event["Records"]:
        bucket = record["s3"]["bucket"]["name"]
        key = unquote_plus(record["s3"]["object"]["key"])  # S3 URL-encodes keys in events

        original = s3.get_object(Bucket=bucket, Key=key)["Body"].read()
        image = Image.open(io.BytesIO(original)).convert("RGB")
        image.thumbnail((300, 300))
        buffer = io.BytesIO()
        image.save(buffer, format="JPEG", quality=85)

        s3.put_object(
            Bucket=bucket,
            Key=key.replace("uploads/", "thumbnails/", 1),
            Body=buffer.getvalue(),
            ContentType="image/jpeg",
        )
    return {"processed": len(event["Records"])}

Infrastructure as Code (SAM)

# template.yaml: AWS SAM template
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31

Globals:
  Function:
    Runtime: nodejs24.x
    Architectures: [arm64]
    Timeout: 30
    MemorySize: 256
    Environment:
      Variables:
        TABLE_NAME: !Ref UsersTable

Resources:
  ApiFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: esbuild
      BuildProperties:
        Minify: true
        Target: es2022
        EntryPoints: [src/handler.ts]
    Properties:
      Handler: handler.handler
      CodeUri: .
      Events:
        ListUsers:
          Type: HttpApi
          Properties: { Path: /users, Method: get }
        GetUser:
          Type: HttpApi
          Properties: { Path: "/users/{id}", Method: get }
        CreateUser:
          Type: HttpApi
          Properties: { Path: /users, Method: post }
      Policies:
        - DynamoDBCrudPolicy:
            TableName: !Ref UsersTable

  ImageProcessor:
    Type: AWS::Serverless::Function
    Properties:
      Runtime: python3.13
      Handler: handler.handler
Full SKILL.md on GitHub

Install aws-lambda in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

_scores.json

FAQ

What does the aws-lambda skill do?

AWS Lambda runs your code on demand without servers, scaling from zero to thousands of concurrent executions and billing per invocation. Use this skill to build Lambda functions in Node.js or Python behind API Gateway, S3, SQS or DynamoDB triggers, define them with AWS SAM, deploy and test them locally, or when asked about "serverless function", "Lambda handler", "SAM template", "cold start" or "Lambda runtime deprecation".

How do I install the aws-lambda skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the aws-lambda skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare aws-lambda with