How to Set Lifecycle Policies Using Postman
    • 19 Dec 2023
    • 5 Minutes to read
    • PDF

    How to Set Lifecycle Policies Using Postman

    • PDF

    Article summary

    Lifecycle Policies

    Lifecycle policies can be a great way to manage the lifespan of your data stored within your buckets. Wasabi users may choose to implement lifecycle rules for compliance, internal policy, or for general housekeeping reasons. Lifecycle policies can be managed in the Console, with AWS CLI commands, or via API requests with an application such as Postman.

    Postman

    Postman is an API platform for building and using APIs. If you do not have any prior experience with the application, we would suggest looking over the Postman Getting Started guide. Please note that you will need to create an account in order to use the Postman platform.

    Lifecycle Configuration Elements

    Lifecycle rules contain the following elements:

    <LifecycleConfiguration>
         <Rule>
              <ID></ID>
              <Filter>
              </Filter>
              <Status></Status>
              <Action>
              </Action>
         </Rule>
    </LifecycleConfiguration>
    • ID element: The element uniquely identifies a rule.

    • Filter element: A Lifecycle rule can apply to all or a subset of objects in a bucket based on the element that you specify in the lifecycle rule.  See below for filter examples.

    • Status element: The element value can be either Enabled or Disabled. If a rule is disabled, Wasabi doesn't perform any of the actions defined in the rule.

    • Action element: You can direct Wasabi to perform specific actions in an object's lifetime by specifying one or more of the following predefined actions in a lifecycle rule.

    Lifecycle Actions

    Wasabi makes use of the following lifecycle actions:

    • - Expire the current version of objects. For versioned buckets, a delete marker is added and the current version of an object is retained as a non-current version. For non-versioned buckets, the object is permanently removed at the end of the specified period.

    • - Permanently delete non-current versions of objects.

    • - Delete expired object delete markers.

    • - Delete incomplete multipart uploads.

    Filter Examples

    Please note that Wasabi requires the field. Rules can be filtered by prefixes and sizes of objects.

    Prefix:

    <Filter>
         <Prefix>logs/</Prefix>
    </Filter>
    An empty Filter of Prefix will apply to the whole bucket.
    
    <Filter>
    </Filter>
    or
    
    <Filter>
         <Prefix></Prefix>
    </Filter>
    Size:
    
    Please note that the size is in Bytes.
    
    <Filter>
         <And>
              <ObjectSizeGreaterThan>1</ObjectSizeGreaterThan>
              <ObjectSizeLessThan>21474836480</ObjectSizeLessThan>
         </And>
    </Filter>

    Initial Postman Configuration

    Please note that the following examples discuss the use of Wasabi's us-east-2 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article.

    1) Click the "+" symbol to start a new API request.

    2) On the Authorization tab, select "AWS Signature" from the dropdown.

    • Confirm that the authorization data is added to the Request Headers.

    • Enter your Access & Secret Key.

    • Choose the region that the bucket is located in.

    • Enter "s3" as the Service Name.

    Actions

    Please note that the following examples discuss the use of Wasabi's us-east-2 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article.

    • Expire current version of objects

    • Permanently delete non-current versions of objects

    • Delete expired objects delete markers

    • Delete incomplete multipart uploads

    Expire current version of objects:

    1) Change the Request Type from "GET" to "PUT" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-lifecycle-bucket?lifecycle

    2) Select the "Body" tab and choose the "raw" option and "XML" from the dropdown menu.

    3) Enter the following XML and click "Send".

    <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
         <Rule>
              <ID>ExpireCurrentVersions</ID>
              <Filter>
                   <Prefix></Prefix>
              </Filter>
              <Status>Enabled</Status>
              <Expiration>
                   <Days>1</Days>
              </Expiration>
         </Rule>
    </LifecycleConfiguration>

    4) If the request was successful you will see a 200 response with an empty body.

    Permanently delete non-current versions of objects:

    1) Change the Request Type from "GET" to "PUT" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-lifecycle-bucket?lifecycle

    2) Select the "Body" tab and choose the "raw" option and "XML" from the dropdown menu.

    3) Enter the following XML and click "Send".

    <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
         <Rule>
              <ID>DeleteAfterBecomingNonCurrent</ID>
              <Filter>
                   <Prefix></Prefix>
              </Filter>
              <Status>Enabled</Status>
              <NoncurrentVersionExpiration>
                   <NoncurrentDays>1</NoncurrentDays>
              </NoncurrentVersionExpiration>
         </Rule>
    </LifecycleConfiguration>

    4) If the request was successful you will see a 200 response with an empty body.

    Delete expired object delete markers:

    1) Change the Request Type from "GET" to "PUT" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-lifecycle-bucket?lifecycle

    2) Select the "Body" tab and choose the "raw" option and "XML" from the dropdown menu.

    3) Enter the following XML and click "Send".

    <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
         <Rule>
              <ID>DeleteExpiredObjectDeleteMarkers</ID>
              <Filter>
                   <Prefix></Prefix>
              </Filter>
              <Status>Enabled</Status>
              <Expiration>
                   <ExpiredObjectDeleteMarker>true</ExpiredObjectDeleteMarker>
              </Expiration>
         </Rule>
    </LifecycleConfiguration>

    4) If the request was successful you will see a 200 response with an empty body.

    Delete incomplete multipart uploads:

    1) Change the Request Type from "GET" to "PUT" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-lifecycle-bucket?lifecycle

    2) Select the "Body" tab and choose the "raw" option and "XML" from the dropdown menu.

     

    3) Enter the following XML and click "Send".

    <LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
         <Rule>
              <ID>DeleteIncompleteMultipartUploads</ID>
              <Filter>
                   <Prefix></Prefix>
              </Filter>
              <Status>Enabled</Status>
              <AbortIncompleteMultipartUpload>
                   <DaysAfterInitiation>1</DaysAfterInitiation>
              </AbortIncompleteMultipartUpload>
         </Rule>
    </LifecycleConfiguration>

    4) If the request was successful you will see a 200 response with an empty body.

    Verification

    Lifecycle rules on a bucket can be verified with a GET request.

    1) Confirm that the Request Type is "GET" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-test-bucket?lifecycle

    2) You will leave the "Body" of the request empty and click "Send".

    3) If the request was successful you will receive a 200 response with output similar to the following in the body.

    Deletion:

    Lifecycle rules on a bucket can be removed with a DELETE request.

    1) Confirm that the Request Type is "DELETE" and enter the service URL for your bucket.

    https://s3.us-east-2.wasabisys.com/my-test-bucket?lifecycle

    2) You will leave the "Body" of the request empty and click "Send".

    3) If the request was successful you will receive a 204 response with an empty body.