title: Authenticate AWS Lambda in Django
body: <p>Issue: I want to authenticate the response from lambda to Django</p>
  
  <p>Summary: My Django app invokes an AWS Lambda with some url, lambda does the processing and a couple of seconds later should return the result to Django. Now, how do I ensure that the response from lambda is valid, and it's not someone trying to call my django endpoint?</p>
  
  <p>Setup:</p>
  
  <p>Django running on an EC2 machine behind nginx + uwsgi</p>
  
  <p>Lambda called from Django using </p>
  
  <pre><code>boto3.client('lambda').invoke(
      FunctionName="my-lambda-name",
      InvocationType='Event',
      Payload=json.dumps(payload)
  ))
  </code></pre>
  
  <p>Lambda code:</p>
  
  <pre><code>def handler(event, context):
      data = event['data']
      result = get_my_result(data)
      requests.post('https://www.example.com/foo/bar', data=json.dumps(result))
  </code></pre>
  
  <p>I was considering Django REST framework, but it's not like I have a specific user calling the lambda, so I think it doesn't quite suite the purpose. </p>
  
  <p>I have never done this kind of 3rd party service authentication in Django, not sure what the most elegant (+secure and efficient) approach would be.</p>
  
  <p>Thanks for help!</p>