title: How to trigger the same lambda function with multiple triggers?
body: <p>The steps my app needs to take are:</p>
  
  <ol>
  <li>In the frontend, the user triggers a lambda function with API gateway which 
  sends a file to s3. </li>
  <li>When the file arrives in s3, trigger the same lambda function to apply video 
  recognition and send jobId to SNS. </li>
  <li>When SNS receives a message, trigger the same lambda function to get the 
  label data and return the data back to the user with the API gateway</li>
  </ol>
  
  <p>All the steps work when I test them individually but, but I don't know how to make the code work together as described above. Should I create multiple lambda functions, use one lambda or try another option.</p>
  
  <p>Note: the label data needs to return back to the user via API</p>
  
  <p>Should be something like this:</p>
  
  <pre><code>rekognition = boto3.client("rekognition")
  sns = boto3.client("sns")
  
  def lambda_handler(event, context):
      # should be triggered when s3 recives file after API call
      response = rekognition.start_label_detection(
          Video = {
              "S3Object": {
                  "Bucket": BUCKET,
                  "Name": KEY
              }
          },
          NotificationChannel = {
              "SNSTopicArn": SNS_TOPIC_ARN,
              "RoleArn": ROLE_ARN
          }
      )
  
      # should be triggerd when sns message has arrived
      if "Records" in event:
          message = event["Records"][0]["Sns"]["Message"]
          #perform get lables here from jobId...
  
  
  
      # should return labels back to the user
      return {
          "statusCode": 200,
          "body": json.dumps(lables),
          "headers": {
          "Access-Control-Allow-Origin": "*",
          "Content-Type": "application/json"
  
          }
      }
  </code></pre>