用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-aws --skill aws-lambda-functions命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | aws-lambda-functions |
| description | Build optimized serverless functions with Lambda |
| sasmp_version | 1.3.0 |
| bonded_agent | 07-aws-serverless |
| bond_type | PRIMARY_BOND |
Develop high-performance serverless functions with best practices.
| Attribute | Value |
|---|---|
| AWS Service | Lambda |
| Complexity | Medium |
| Est. Time | 5-15 min |
| Prerequisites | IAM Role, (Optional) VPC |
| Parameter | Type | Description | Validation |
|---|---|---|---|
| function_name | string | Function name | ^[a-zA-Z0-9-_]{1,64}$ |
| runtime | string | Runtime environment | python3.12, nodejs20.x, etc. |
| handler | string | Handler function | module.function |
| role_arn | string | Execution role ARN | Valid IAM role ARN |
| Parameter | Type | Default | Description |
|---|---|---|---|
| memory_mb | int | 128 | Memory allocation (128-10240) |
| timeout | int | 3 | Timeout seconds (1-900) |
| architecture | string | x86_64 | x86_64 or arm64 |
| environment | object | {} | Environment variables |
| vpc_config | object | null | VPC configuration |
1. Package code and dependencies
2. Create/update function
3. Configure triggers
4. Set concurrency limits
5. Test invocation
6. Monitor cold starts
# Create deployment package
zip -r function.zip . -x "*.git*"
# Create function
aws lambda create-function \
--function-name my-function \
--runtime python3.12 \
--architectures arm64 \
--handler main.handler \
--role arn:aws:iam::123456789012:role/lambda-role \
--zip-file fileb://function.zip \
--memory-size 1024 \
--timeout 30 \
--environment "Variables={LOG_LEVEL=INFO}" \
--tracing-config Mode=Active
import json
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
"""
Lambda handler function.
Args:
event: Trigger event data
context: Runtime context (request_id, memory_limit, etc.)
Returns:
Response object or value
"""
try:
logger.info(f"Event: {json.dumps(event)}")
# Business logic here
result = process_event(event)
return {
"statusCode": 200,
"body": json.dumps(result)
}
except Exception as e:
logger.error(f"Error: {str(e)}")
return {
"statusCode": 500,
"body": json.dumps({"error": str(e)})
}
export const handler = async (event, context) => {
console.log('Event:', JSON.stringify(event));
try {
const result = await processEvent(event);
return {
statusCode: 200,
body: JSON.stringify(result)
};
} catch (error) {
console.error('Error:', error);
return {
statusCode: 500,
body: JSON.stringify({ error: error.message })
};
}
};
| Memory | vCPU | Network | Use Case |
|---|---|---|---|
| 128 MB | 0.08 | Low | Simple transforms |
| 512 MB | 0.33 | Low | Basic API handlers |
| 1024 MB | 0.58 | Medium | Standard workloads |
| 1769 MB | 1.0 | Medium | CPU-bound tasks |
| 3008 MB | 2.0 | High | Parallel processing |
| 10240 MB | 6.0 | Very High | Data processing |
| Symptom | Cause | Solution |
|---|---|---|
| Timeout | Long execution | Increase timeout, optimize code |
| OOM (signal: killed) | Memory exceeded | Increase memory |
| Import error | Missing dependency | Check package includes deps |
| Permission denied | IAM role | Update execution role |
Task timed out after X.XX seconds → Increase timeout
Runtime exited with error: signal: killed → Increase memory
Unable to import module → Check handler path/dependencies
ECONNREFUSED → Check VPC/security group
def test_lambda_handler():
# Arrange
event = {"key": "value"}
context = MockContext()
# Act
response = handler(event, context)
# Assert
assert response["statusCode"] == 200
body = json.loads(response["body"])
assert "result" in body
from aws_xray_sdk.core import xray_recorder
@xray_recorder.capture('process_data')
def process_data(data):
# Traced function
pass
{
"level": "INFO",
"message": "Processing request",
"request_id": "abc-123",
"function_name": "my-function",
"cold_start": true
}
assets/lambda-template.py - Python handler template基于 SOC 职业分类