"""Lambda handler for proxying request from SNS to StepFunction.""" import os import json import boto3 STATEMACHINE_ARN = os.environ.get('STATEMACHINE_ARN') sfn_client = boto3.client('stepfunctions') def index(event, context): """Lambda entry point. Args: event (dict): Information about uploaded image. context (dict): Environment state. Returns: dict: Dict with start execution results """ response = sfn_client.start_execution( stateMachineArn=STATEMACHINE_ARN, input=json.dumps(event) ) return { "statusCode": 200, "executionArn": response['executionArn'] }