I deployed an AWS Lambda Function which triggers on S3 bucket event creation using Chalice, but the lambda function is not triggered when I upload an object to the S3 bucket. The Cloudwatch logs and metrics don't show any data.
The code is as follows:
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")
The requirements.txt file is as follows:
boto3
I also observed that the code is not there in the Function code section under the Configuration tab in the Lambda function management console.