I am new to the AWS services.I am trying to read a csv file from AWS S3 bucket but I cannot read or get any output from AWS lambda.
import json
import boto3
import csv
s3_client = boto3.client('s3')
def lambda_handler(event, context):
# TODO implement
try:
bucket_name = event["Records"][0]["s3"]["bucket"]["name"]
s3_file_name = event["Records"][0]["s3"]["object"]["key"]
csv_file = s3_client.get_object(Bucket=bucket_name, Key=s3_file_name)
data = csv_file['Body'].read().splitlines(True)
reader = csv.reader(data)
print(reader)
except Exception as err:
print(err)
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
I am getting this output but I don't get data from my print line why is that?
please help me!


s3reqtest event?datato see whether it contains anything? Anything that is printed should appear in the log file.