我部署了一个AWS Lambda函数,该函数在使用Chalice创建S3存储桶事件时触发,但是当我将对象上载到S3存储桶时,不会触发lambda函数。 Cloudwatch日志和指标不显示任何数据。
代码如下:
from chalice import Chalice
import boto3
app = Chalice(app_name='ChaliceLambdaTest1')
app.debug = True #Set the debug mode
s3 = boto3.client('s3')
@app.on_s3_event(bucket='chalicetestbucket1', events=['s3:ObjectCreated:*']) #Sample S3 bucket name
def handler(event):
print("Object uploaded for bucket: %s, key: %s"
% (event.bucket, event.key))
print("Lamba triggered due to S3 event")
app.log.debug("Lambda function triggered due to S3 event")
requirements.txt文件如下:
boto3
我还观察到Lambda功能管理控制台的配置标签下的功能代码部分中没有该代码。