"""This Lambda sends transcoding status to SNS topic.""" import os import boto3 sns_client = boto3.client('sns') def send_transcoding_status(event): """Send sns message with event['status'] to topic with name: SNS_TOPIC_ARN. Args: event: (dict): Information about file transcoding process. """ topic_arn = os.environ.get('SNS_TOPIC_ARN') sns_client.publish(TopicArn=topic_arn, Message=event['status']) def handler(event, context): """Lambda handler. Args: event: (dict): Information about uploaded file. context: (dict): Environment state. Returns: str: 'Finish' """ send_transcoding_status(event) return 'Finish'