Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 64 additions & 12 deletions docs/buckets/object-lifecycle-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

As your data storage needs evolve, you may want to optimize costs by moving less
frequently accessed objects to more cost-effective storage tiers. Tigris
provides an object lifecycle rule to automatically move objects between storage
provides object lifecycle rules to automatically move objects between storage
tiers. For example, you might want to move older log files or archived data to a
lower-cost storage tier while keeping frequently accessed data in the standard
tier. This helps to maintain optimal performance for active data while reducing
storage costs for infrequently accessed objects.

## Configuring an Object Lifecycle Rule
## Configuring Object Lifecycle Rules

With Object Lifecycle rules, you can configure when and how your objects
transition between storage tiers. This is done at the bucket level and applies
to all objects within that bucket.
transition between storage tiers. Rules are configured at the bucket level and
each rule can target the entire bucket or a subset of objects scoped by a key
prefix.

A bucket can have up to **10 lifecycle rules**, which can be a mix of transition
and expiration rules scoped to different prefixes. See
[Object Expiration](/docs/buckets/objects-expiration/) for the expiration form
of these rules.

The transition timing can be set in two ways:

Expand Down Expand Up @@ -41,7 +47,7 @@ these three storage tiers:
quickly when requested, such as monthly reports, quarterly analytics, or
seasonal data that might be needed on short notice.

### Specifying an Object Lifecycle rule via the Tigris Dashboard
### Specifying Object Lifecycle rules via the Tigris Dashboard

You can specify lifecycle transition rules for your bucket using the
[Tigris Dashboard](https://console.storage.dev/).
Expand All @@ -53,24 +59,25 @@ a bucket:
<img src="https://cdn.loom.com/sessions/thumbnails/cb502607f86c443b835575681922f01c-7a7b4d8fdc70c5ed-full-play.gif"/>
</a>

### Specifying an Object Lifecycle rule via the AWS CLI
### Specifying Object Lifecycle rules via the AWS CLI

You can configure an Object Lifecycle rule for objects in the bucket using AWS
the CLI. Below are some examples of how you can configure the lifecycle
transition rules.
You can configure Object Lifecycle rules for objects in the bucket using the AWS
CLI. Below are some examples.

#### Transition objects after 30 days

Here's an example of an Object Lifecycle configuration that transitions objects
after 30 days.
Here's an example of an Object Lifecycle configuration that transitions all
objects in the bucket after 30 days.

Create a JSON file named `lifecycle.json` with the following content:

```json
{
"Rules": [
{
"ID": "transition-ia",
"Status": "Enabled",
"Filter": {},
"Transitions": [
{
"Days": 30,
Expand Down Expand Up @@ -100,7 +107,9 @@ Create a JSON file named `lifecycle.json` with the following content:
{
"Rules": [
{
"ID": "archive-eoy",
"Status": "Enabled",
"Filter": {},
"Transitions": [
{
"Date": "2025-12-31T00:00:00Z",
Expand All @@ -119,10 +128,53 @@ bucket:
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket --lifecycle-configuration file://lifecycle.json
```

#### Multiple rules with prefix filters

Each rule can be scoped to a key prefix using `Filter.Prefix`. The example below
moves objects under `logs/` to `STANDARD_IA` after 30 days, archives objects
under `archive/` to `GLACIER` after 90 days, and leaves the rest of the bucket
on `STANDARD`.

```json
{
"Rules": [
{
"ID": "logs-to-ia",
"Status": "Enabled",
"Filter": { "Prefix": "logs/" },
"Transitions": [
{
"Days": 30,
"StorageClass": "STANDARD_IA"
}
]
},
{
"ID": "archive-to-glacier",
"Status": "Enabled",
"Filter": { "Prefix": "archive/" },
"Transitions": [
{
"Days": 90,
"StorageClass": "GLACIER"
}
]
}
]
}
```

## Things to note

- A bucket can have at most 10 lifecycle rules. The 10-rule limit is shared
across transition and expiration rules.
- Each rule may include an `ID` (up to 36 characters). If you omit `ID`, Tigris
generates one.
Comment on lines +171 to +172
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Reserved ID prefixes not documented

The PR description notes that desc and *-desc are reserved ID prefixes, but this constraint isn't captured anywhere in the documentation. Users who accidentally use a reserved prefix will receive an unexpected error. Consider adding a note here.

- Use `Filter.Prefix` on a rule to scope it to a subset of objects. Omit
`Filter` (or pass an empty object `{}`) to apply the rule to every object in
the bucket.
- Each rule can include at most one transition.
- Tigris always rounds the transition time to UTC midnight for the scheduled
date.
- Only one Object Lifecycle rule can be applied to a bucket at a time.
- When using the AWS CLI to apply an Object Lifecycle configuration, the JSON
can only contain the fields shown in the examples above.
61 changes: 53 additions & 8 deletions docs/buckets/objects-expiration.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Object Expiration

If you use Tigris to store objects that have a limited lifetime, you can now set
up bucket lifecycle configuration rules to automatically delete them after a
If you use Tigris to store objects that have a limited lifetime, you can set up
bucket lifecycle configuration rules to automatically delete them after a
specified period.

## Configuring object expiration

Tigris allows you to set up a expiration configuration for objects in a bucket
Tigris allows you to set up expiration configuration for objects in a bucket
through bucket lifecycle rules. The expiration is based on the last modified
time of the object.

A bucket can have up to **10 lifecycle rules**, which can be a mix of expiration
and transition rules scoped to different prefixes. See
[Object Lifecycle Rules](/docs/buckets/object-lifecycle-rules/) for the
transition form of these rules.

The expiration can be set in two ways:

- **Days**: The objects will be deleted after the specified number of days.
Expand All @@ -29,21 +34,23 @@ bucket:

### Specifying expiration rules via the AWS CLI

You can configure expiration rules for objects in the bucket using AWS the CLI.
Below are some examples of how you can configure the expiration rules.
You can configure expiration rules for objects in the bucket using the AWS CLI.
Below are some examples.

#### Expire objects after 30 days

Here's an example of a bucket lifecycle configuration that expires objects after
30 days.
Here's an example of a bucket lifecycle configuration that expires every object
in the bucket after 30 days.

Create a JSON file named `lifecycle.json` with the following content:

```json
{
"Rules": [
{
"ID": "expire-30d",
"Status": "Enabled",
"Filter": {},
"Expiration": {
"Days": 30
}
Expand All @@ -70,7 +77,9 @@ Create a JSON file named `lifecycle.json` with the following content:
{
"Rules": [
{
"ID": "expire-eoy",
"Status": "Enabled",
"Filter": {},
"Expiration": {
"Date": "2025-12-31T00:00:00Z"
}
Expand All @@ -86,11 +95,47 @@ bucket:
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket --lifecycle-configuration file://lifecycle.json
```

#### Different expirations per prefix

Each rule can be scoped to a key prefix using `Filter.Prefix`, so different
parts of a bucket can have different expirations. The example below deletes
objects under `tmp/` after 1 day and objects under `logs/` after 30 days, while
leaving everything else untouched.

```json
{
"Rules": [
{
"ID": "expire-tmp",
"Status": "Enabled",
"Filter": { "Prefix": "tmp/" },
"Expiration": {
"Days": 1
}
},
{
"ID": "expire-logs",
"Status": "Enabled",
"Filter": { "Prefix": "logs/" },
"Expiration": {
"Days": 30
}
}
]
}
```

## Things to note

- A bucket can have at most 10 lifecycle rules. The 10-rule limit is shared
across expiration and transition rules.
- Each rule may include an `ID` (up to 36 characters). If you omit `ID`, Tigris
generates one.
Comment on lines +132 to +133
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Reserved ID prefixes not documented

Same omission as in object-lifecycle-rules.md — the reserved desc and *-desc ID prefixes mentioned in the PR description are absent from this page's "Things to note" section as well.

- Use `Filter.Prefix` on a rule to scope it to a subset of objects. Omit
`Filter` (or pass an empty object `{}`) to apply the rule to every object in
the bucket.
- Tigris always rounds the expiration time to UTC midnight for the scheduled
date.
- The expiration time is based on the last modified time of the object.
- Only one object expiration rule can be applied to a bucket at a time.
- When using the AWS CLI to apply a bucket lifecycle configuration, the JSON can
only contain the fields shown in the examples above.
Loading