I am creating an AWS Lambda function using Python to create a file in an S3 bucket but it is only creating one row. Need iteration based creation.
Below is my code:
import json
import boto3
s3 = boto3.client('s3')
def lambda_handler(event, context):
bucket ='xyz'
eventToUpload = {}
eventToUpload['ITEM_ID'] = 1234
eventToUpload['Name'] = John
eventToUpload['Office'] = NY
fileName = 'testevent' + '.json'
uploadByteStream = bytes(json.dumps(eventToUpload).encode('UTF-8'))
s3.put_object(Bucket=bucket, Key=fileName, Body=uploadByteStream)
print('Put Complete')
Above code is creating a json file in the S3 bucket but I want to iteration of say 5 so that file has 5 record.