agentleFS
Ghost7802Ghost7802/awesome-api-skills/skills/aws-lambda/SKILL.md

aws-lambda

Skill13 starsChanged 25 days agoMITView on GitHub

Verification Tier: code_example_tested | Last Verified: 2026-11-18 Official Docs: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html

  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never log raw Authorization headers or secret values to CloudWatch Logs.

    line 30

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

AWS Lambda Handler Patterns Skill

Verification Tier: code_example_tested | Last Verified: 2026-11-18
Official Docs: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html

Overview

AWS Lambda runs event-driven serverless functions triggered by API Gateway, SQS, EventBridge, DynamoDB Streams, and S3. Production reliability depends on idempotent handlers, partial batch failure reporting, execution-context reuse, and strict timeout budgets.

Installation

npm install -D @types/aws-lambda

Authentication

Rely exclusively on the Lambda Function IAM Execution Role (temporary STS credentials injected into the runtime environment). Never store static AWS access keys in Lambda environment variables.

Core Concepts

  • Execution Environment Reuse: Initialize SDK clients and database pools outside the exported handler so warm invocations reuse TCP/TLS connections.
  • SQS Partial Batch Failures: Enable FunctionResponseTypes: ["ReportBatchItemFailures"] on the SQS Event Source Mapping and return { batchItemFailures: [{ itemIdentifier: record.messageId }] }. Without this, throwing an error re-queues the ENTIRE batch and re-processes already-succeeded messages!
  • Timeout Guarding: Set outbound HTTP/DB timeouts below context.getRemainingTimeInMillis() - 1000 so you can log clean diagnostics before Lambda hard-kills the process.

Error Handling & Rate Limits

  • Configure an SQS Dead-Letter Queue (DLQ) with maxReceiveCount (e.g., 3–5) to isolate poison-pill messages.
  • Set VisibilityTimeout on the source SQS queue to at least 6x the Lambda function timeout.
  • Configure Reserved Concurrency on downstream-sensitive functions to avoid exhausting relational DB connection pools.

Security Best Practices

  • Apply least-privilege IAM policies scoped to exact queue/table/bucket ARNs.
  • Validate all API Gateway / EventBridge event payloads at runtime (e.g., with zod).
  • Never log raw Authorization headers or secret values to CloudWatch Logs.

AI Pitfalls

  • Throwing on a single bad SQS message without ReportBatchItemFailures, causing infinite reprocessing of healthy records in the same batch.
  • Opening a fresh database/SDK connection inside handler() on every invocation.
  • Setting SQS VisibilityTimeout shorter than Lambda timeout, causing duplicate concurrent execution.

Production Checklist

  • SDK/DB clients initialized at module scope outside handler
  • SQS handlers return SQSBatchResponse with batchItemFailures
  • SQS VisibilityTimeout >= 6 * LambdaTimeout and DLQ configured
  • Outbound requests use timeouts bounded by remaining Lambda execution time

References

Related skills

  • aws-bedrock — works well with
  • aws-s3 — works well with
  • aws-dynamodb — works well with

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.