I'm trying to craft a Lambda function using event data from an S3 trigger I have setup on a bucket. My first function works as expected and prints the event data. However, when I try and pull that event data into the next function the bucket name does not print which is what I expected. What am I missing here? Can I not pull event data into other functions to grab pieces of it?
import boto3
s3 = boto3.client("s3")
def lambda_handler(event, context):
s3_upload_record = event
print(s3_upload_record)
def print_bucket_name(s3_upload_record):
bucket_name = s3_upload_record["Records"][0]["s3"]["bucket"]["name"]
print(bucket_name)