Setting Lifecycle Policies Using Postman

Prev Next

Lifecycle policies can be a good way to manage the lifespan of your data stored within your buckets. You can implement lifecycle rules for compliance, internal policy, or general housekeeping. Lifecycle policies can be managed in the Console, with AWS CLI commands, or using API requests with an application such as Postman (as described in this article).

Postman is an API platform for building and using APIs. If you do not have experience with the application, review the Postman Getting Started guide. You will need to create an account 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: The ID element uniquely identifies a rule.

  • Filter: 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: This element value can be Enabled or Disabled. If a rule is disabled, Wasabi does not perform any of the actions defined in the rule.

  • Action: 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 noncurrent version. For non-versioned buckets, the object is permanently removed at the end of the specified period.

  • Permanently delete noncurrent versions of objects.

  • Delete expired object delete markers.

  • Delete incomplete multipart uploads.

Filter Example

Rules can be filtered by prefixes and sizes of objects. Wasabi requires the Prefix field.

<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>

Configuring Postman

In the following example, the policy is applied to a bucket in the us-east-2 region. Refer to Service URLs for Wasabi's Storage Regions for a list of all available service endpoints/regions.

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

  2. On the Authorization tab, select AWS Signature from the drop-down.

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

  4. Enter your access and secret keys.

  5. Choose the region in which the bucket is located.

  6. Enter s3 as the Service Name.

Setting Actions

The actions described in this section use examples in which the policy is applied to a bucket in the us-east-2 region. Refer to Service URLs for Wasabi's Storage Regions for a list of all available service endpoints/regions.

Expiring the 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. Select the raw option and XML from the drop-down.

  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>

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

Permanently Deleting Noncurrent 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. Select the raw option and XML from the drop-down.

  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>

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

Deleting 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. Select the raw option and XML from the drop-down.

  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>

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

Deleting 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. Select the raw option and XML from the drop-down.

  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>

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

Verifying Lifecycle Rules on a Bucket

You can verify lifecycle rules on a bucket 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. Leave the Body of the request empty and click Send.

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

Deleting Lifecycle Rules on a Bucket

You can delete lifecycle rules on a bucket 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. Leave the Body of the request empty and click Send.

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