23 lines
621 B
Python
23 lines
621 B
Python
from aws_lambda_powertools.utilities.data_classes import (
|
|
EventBridgeEvent,
|
|
event_source,
|
|
)
|
|
from aws_lambda_powertools.utilities.typing import LambdaContext
|
|
|
|
from boto3clients import s3_client
|
|
from config import CHUNK_SIZE
|
|
from csv_utils import byte_ranges
|
|
|
|
transport_params = {'client': s3_client}
|
|
|
|
|
|
@event_source(data_class=EventBridgeEvent)
|
|
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|
new_image = event.detail['new_image']
|
|
csvfile = new_image['s3_uri']
|
|
pairs = byte_ranges(csvfile, CHUNK_SIZE, transport_params=transport_params)
|
|
|
|
print(pairs)
|
|
|
|
return True
|