import json
import base64
import datetime
def lambda_handler(event, context):
output = []
for record in event['records']:
payload = base64.b64decode(record['data']).decode()
json_value = json.loads(payload)
print(payload)
time_format = "%Y-%m-%d %H:%M:%S"
partition_keys = {
}
output_record = {
'recordId': record['recordId'],
'result': 'Ok', # 혹은 DeliveryFailed, Dropped
'data': base64.b64encode(json.dumps(json_value).encode()),
'metadata': { 'partitionKeys': partition_keys }
}
output.append(output_record)
return {'records': output}
# S3 버킷 접두사
year=!{partitionKeyFromLambda:year}/month=!{partitionKeyFromLambda:month}/
day=!{partitionKeyFromLambda:day}/hour=!{partitionKeyFromLambda:hour}/