title: How to get the latest record inserted in dynamodb
body: <p>I want to retrieve the latest inserted record in dynamodb so that whenever a new record is inserted it the dynamodb table a lambda will trigger and fetch the record and pass it on to a python script.</p>
  
  <p>I am writing the lambda in Python 2.7 </p>
  
  <pre><code>import json
  import boto3
  from boto3.dynamodb.conditions import Key, Attr
  
  def lambda_handler(event, context):
    dynamodb = boto3.resource('dynamodb')
    table = dynamodb.Table("html_contents")
    try:
       if (record.eventName == "INSERT") {
           #How to Retrieve the latest record 
       }
    except Exception, e:
      print(e)
  </code></pre>