title: Check s3 objects and notify if they are in the bucket for more than 1 hour
body: <p>I am looking to create a lambda which will constantly monitor my directory in the s3 bucket and will notify if the objects resides in the bucket for more than 1 hour after the upload. We already have a lambda to archive the object after processing which is invoked based on s3 events. But I need a function to calculate the time of the object and notify.</p>
  <p>I tried something like this. Doesn't help.</p>
  <pre><code>import boto3
  import datetime
  s3=boto3.resource('s3')
  my_bucket=s3.Bucket('mybucketname')
  def obj_age(s3):
      modified=s3.ObjectSummary('last_modified')
      return modified
      modified=obj_age(s3)
      if len(obj_age)==modified-datetime.timedelta(hours=1):
          return [&quot;\nFound %i files more than %s hours old in %s.&quot; % (len(old_age), 1, bucket.name))]
  </code></pre>