Aws Lambda Functions

aj-geddes/useful-ai-prompts/skills/aws-lambda-functions

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Create and deploy serverless functions using AWS Lambda with event sources, permissions, layers, and environment configuration. Use for event-driven computing without managing servers.

包含腳本DevOps & Cloud
AI 產生的概覽

指導使用 CLI、Node.js、SAM、Terraform 與層來建立及部署 AWS Lambda 無伺服器函式。

功能
此技能提供用於建置與部署 AWS Lambda 無伺服器函式的參考指南與範本。內容涵蓋基礎 AWS CLI 建立、Node.js 處理常式、用於共用程式碼的 Lambda 層、SAM 與 Terraform 部署,以及權限、事件來源與環境設定。它也附帶一支驗證指令碼與一個 API 範本檔。
適用情境
當你需要為事件驅動型工作負載(例如 API 端點、排程工作、檔案處理或微服務)建立、設定或部署 AWS Lambda 函式時使用。它適合使用 AWS CLI、SAM 或 Terraform 並希望取得實用部署模式的團隊。
執行需求
需要具備憑證的 AWS 帳戶與 AWS CLI;部分指南還需要 Node.js、Terraform 或 AWS SAM CLI。需要連線至 AWS 的網路存取,技能附帶一支可執行驗證指令碼與一個 YAML 範本。

AWS Lambda Functions

Table of Contents

Overview

AWS Lambda enables you to run code without provisioning or managing servers. Build serverless applications using event-driven triggers, pay only for compute time consumed, and scale automatically with workload.

When to Use

  • API endpoints and webhooks
  • Scheduled batch jobs and data processing
  • Real-time file processing (S3 uploads)
  • Event-driven workflows (SNS, SQS)
  • Microservices and backend APIs
  • Data transformations and ETL jobs
  • IoT and sensor data processing
  • WebSocket connections

Quick Start

Minimal working example:

bash
# Create Lambda execution roleaws iam create-role \  --role-name lambda-execution-role \  --assume-role-policy-document '{    "Version": "2012-10-17",    "Statement": [{      "Effect": "Allow",      "Principal": {"Service": "lambda.amazonaws.com"},      "Action": "sts:AssumeRole"    }]  }'
# Attach basic execution policyaws iam attach-role-policy \  --role-name lambda-execution-role \  --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
# Create function from ZIPzip function.zip index.jsaws lambda create-function \  --function-name my-function \  --runtime nodejs18.x \  --role arn:aws:iam::ACCOUNT:role/lambda-execution-role \  --handler index.handler \  --zip-file fileb://function.zip \// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Basic Lambda Function with AWS CLI [blocked]Basic Lambda Function with AWS CLI
Lambda Function with Node.js [blocked]Lambda Function with Node.js
Terraform Lambda Deployment [blocked]Terraform Lambda Deployment
Lambda with SAM (Serverless Application Model) [blocked]Lambda with SAM (Serverless Application Model)
Lambda Layers for Code Sharing [blocked]Lambda Layers for Code Sharing

Best Practices

✅ DO

  • Use environment variables for configuration
  • Implement proper error handling and logging
  • Optimize package size and dependencies
  • Set appropriate timeout and memory
  • Use Lambda Layers for shared code
  • Implement concurrency limits
  • Enable X-Ray tracing for debugging
  • Use reserved concurrency for critical functions

❌ DON'T

  • Store sensitive data in code
  • Create long-running operations (>15 min)
  • Ignore cold start optimization
  • Forget to handle concurrent executions
  • Ignore CloudWatch metrics
  • Use too much memory unnecessarily

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/aws-lambda-functions提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架