Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

aws-lambda

БесплатноБез исполняемых скриптовНе проверен

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…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub17 установок в других каталогах

Об этом скилле

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
Полный SKILL.md на GitHub

Установить aws-lambda в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл aws-lambda?

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".

Как установить скилл aws-lambda?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл aws-lambda запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить aws-lambda с