Skip to content
boopsie edited this page Feb 12, 2012 · 1 revision

Set the lifecycle for a bucket:

First create an XML control file (lifecycle.xml):

<?xml version="1.0" encoding="UTF-8"?>
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
   <Rule>
      <ID>1-day-rule</ID>
      <Prefix>doomed</Prefix>
      <Status>Enabled</Status>
      <Expiration>
         <Days>1</Days>
      </Expiration>
   </Rule>
</LifecycleConfiguration>

Then set the configuration:

$ aws put --md5 1day?lifecycle lifecycle.xml

Get the lifecycle for a bucket:

$ aws get 1day?lifecycle
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <Rule>
                <ID>1-day-rule</ID>
                <Prefix>doomed</Prefix>
                <Status>Enabled</Status>
                <Expiration>
                        <Days>1</Days>
                </Expiration>
        </Rule>
</LifecycleConfiguration>