cloud config_error ai_generated true

Lambda 触发器缺少 S3 事件通知:S3 存储桶 'my-bucket' 没有为 Lambda 函数 'my-function' 配置事件通知

Missing S3 event notification for Lambda trigger: S3 bucket 'my-bucket' has no event notification configuration for Lambda function 'my-function'

ID: cloud/aws-lambda-s3-event-source-missing-notification

其他格式: JSON · Markdown 中文 · English
95%修复率
88%置信度
1证据数
2023-11-01首次发现

版本兼容性

版本状态引入弃用备注
aws_cli active
lambda_runtime active
s3 active

根因分析

S3 存储桶未配置事件通知以调用 Lambda 函数,通常是由于手动删除了通知或存储桶策略不正确。

English

The S3 bucket does not have an event notification configured to invoke the Lambda function, often due to manual deletion of the notification or incorrect bucket policy.

generic

官方文档

https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html

解决方案

  1. Use AWS CLI to add the event notification: `aws s3api put-bucket-notification-configuration --bucket my-bucket --notification-configuration file://config.json` where config.json contains: `{"LambdaFunctionConfigurations": [{"LambdaFunctionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-function", "Events": ["s3:ObjectCreated:*"]}]}`
  2. Check and update the Lambda resource-based policy to allow S3 invoke: `aws lambda add-permission --function-name my-function --statement-id s3-invoke --action lambda:InvokeFunction --principal s3.amazonaws.com --source-arn arn:aws:s3:::my-bucket`

无效尝试

常见但无效的做法:

  1. 50% 失败

    The console may not create the notification if the bucket already has a notification limit (max 100) or if permissions are insufficient.

  2. 80% 失败

    The bucket policy is independent of event notifications; the notification itself must be configured via S3 API.