跳到正文
Skillpedia
API 与服务器(后端)48k · #3867

aws-serverless-eda

它能做什么

这份指南可以帮你在 Amazon Web Services(AWS)上构建可扩展的事件驱动型应用。它会讲解如何创建小而专注的函数,如何利用事件连接各项服务,以及如何确保即使出现错误,系统仍能正常运行。

适用场景

  • ✓在无需专用服务器的情况下构建应用(使用 Lambda)。
  • ✓设计能对事件做出响应的系统(比如文件上传时触发处理)。
  • ✓创建相互通信的小型服务(即微服务)。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-serverless-eda/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/aws-serverless-eda/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“如果 Lambda 函数收到同一个事件,如何确保它不会重复执行同样的操作?”

每周 5 个新技能,1 分钟读完。

工作原理

它会运用 AWS 的“Well-Architected Framework”(良好架构框架)原则来提供建议。也就是说,遵循构建稳健、安全、高效云端应用的最佳实践。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

AWS Serverless & Event-Driven Architecture

This skill provides comprehensive guidance for building serverless applications and event-driven architectures on AWS based on Well-Architected Framework principles.

AWS Documentation Requirement

Always verify AWS facts using MCP tools (mcp__aws-mcp__* or mcp__*awsdocs*__*) before answering. The aws-mcp-setup dependency is auto-loaded — if MCP tools are unavailable, guide the user through that skill's setup flow.

Serverless MCP Servers

This skill leverages the CDK MCP server (provided via aws-cdk-development dependency) and AWS Documentation MCP for serverless guidance.

Note: The following AWS MCP servers are available separately via the Full AWS MCP Server (see aws-mcp-setup skill) and are not bundled with this plugin:

  • AWS Serverless MCP — SAM CLI lifecycle (init, deploy, local test)
  • AWS Lambda Tool MCP — Direct Lambda invocation
  • AWS Step Functions MCP — Workflow orchestration
  • Amazon SNS/SQS MCP — Messaging and queue management

When to Use This Skill

Use this skill when:

  • Building serverless applications with Lambda
  • Designing event-driven architectures
  • Implementing microservices patterns
  • Creating asynchronous processing workflows
  • Orchestrating multi-service transactions
  • Building real-time data processing pipelines
  • Implementing saga patterns for distributed transactions
  • Designing for scale and resilience

AWS Well-Architected Serverless Design Principles

1. Speedy, Simple, Singular

Functions should be concise and single-purpose

// ✅ GOOD - Single purpose, focused function
export const processOrder = async (event: OrderEvent) => {
  // Only handles order processing
  const order = await validateOrder(event);
  await saveOrder(order);
  await publishOrderCreatedEvent(order);
  return { statusCode: 200, body: JSON.stringify({ orderId: order.id }) };
};

// ❌ BAD - Function does too much
export const handleEverything = async (event: any) => {
  // Handles orders, inventory, payments, shipping...
  // Too many responsibilities
};

Keep functions environmentally efficient and cost-aware:

  • Minimize cold start times
  • Optimize memory allocation
  • Use provisioned concurrency only when needed
  • Leverage connection reuse

2. Think Concurrent Requests, Not Total Requests

Design for concurrency, not volume

Lambda scales horizontally - design considerations should focus on:

  • Concurrent execution limits
  • Downstream service throttling
  • Shared resource contention
  • Connection pool sizing
// Consider concurrent Lambda executions accessing DynamoDB
const table = new dynamodb.Table(this, 'Table', {
  billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, // Auto-scales with load
});

// Or with provisioned capacity + auto-scaling
const table = new dynamodb.Table(this, 'Table', {
  billingMode: dynamodb.BillingMode.PROVISIONED,
  readCapacity: 5,
  writeCapacity: 5,
});

// Enable auto-scaling for concurrent load
table.autoScaleReadCapacity({ minCapacity: 5, maxCapacity: 100 });
table.autoScaleWriteCapacity({ minCapacity: 5, maxCapacity: 100 });

3. Share Nothing

Function runtime environments are short-lived

// ❌ BAD - Relying on local file system
export const handler = async (event: any) => {
  fs.writeFileSync('/tmp/data.json', JSON.stringify(data)); // Lost after execution
};

// ✅ GOOD - Use persistent storage
export const handler = async (event: any) => {
  await s3.putObject({
    Bucket: process.env.BUCKET_NAME,
    Key: 'data.json',
    Body: JSON.stringify(data),
  });
};

State management:

  • Use DynamoDB for persistent state
  • Use Step Functions for workflow state
  • Use ElastiCache for session state
  • Use S3 for file storage

4. Assume No Hardware Affinity

Applications must be hardware-agnostic

Infrastructure can change without notice:

  • Lambda functions can run on different hardware
  • Container instances can be replaced
  • No assumption about underlying infrastructure

Design for portability:

  • Use environment variables for configuration
  • Avoid hardware-specific optimizations
  • Test across different environments

5. Orchestrate with State Machines, Not Function Chaining

Use Step Functions for orchestration

// ❌ BAD - Lambda function chaining
export const handler1 = async (event: any) => {
  const result = await processStep1(event);
  await lambda.invoke({
    FunctionName: 'handler2',

…
常见问题

什么是“微服务”?

微服务就像一个个小型的独立应用,它们相互协作,共同组成一个更大的系统。每个微服务负责一项特定的任务。

什么是“事件驱动架构”?

这是一种构建系统的方式:由事件触发其他动作,而不是让一个程序直接命令另一个程序去做某件事。

什么是“Lambda”?

它是 AWS 的一项服务,让你无需管理服务器就能运行代码。你只需为代码实际运行的时间付费。

详情

作者的原始描述

AWS serverless and event-driven architecture expert based on Well-Architected Framework. Use when building serverless APIs, Lambda functions, REST APIs, microservices, or async workflows.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3867
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能