title: How can I set the S3 object lifecycle using boto?
body: <p>I have uploaded several files to Amazon S3 using <a href="https://github.com/boto/boto" rel="noreferrer">boto</a>. However, I failed to set a lifecycle using statement (I know this can be done using the <a href="http://aws.amazon.com/console/" rel="noreferrer">AWS Management Console</a>, but I need to allow each user to decide how long want to keep the file).</p>
  
  <p>The <a href="http://docs.pythonboto.org/en/latest/ref/s3.html?highlight=lifecycle" rel="noreferrer">boto API reference for S3</a> properly documents <a href="http://docs.pythonboto.org/en/latest/ref/s3.html?highlight=lifecycle#boto.s3.bucket.Bucket.configure_lifecycle" rel="noreferrer">configure_lifecycle(lifecycle_config, headers=None)</a> as the solution, but I'm unable to configure this. Can anyone correct my code?</p>
  
  <p>Thanks!</p>
  
  <pre><code>key='key'
  secretkey='secretkey'
  
  #build the connection
  conn = S3Connection(key, secretkey)
  bucket = conn.create_bucket('przm')
  k=Key(bucket)
  
  #select and upload the file
  name1='run1'
  k.key=name1
  k.set_contents_from_filename('RUN')
  link1='https://s3.amazonaws.com/przm/'+name1
  #allow anyone can download this file
  k.set_acl('public-read-write')
  
  #delete this file after one day. Can anyone give me some help here?
  configure_lifecycle(lifecycle_config, headers=None)
  </code></pre>