# Cold Storage

> Learn how to configure AWS S3 cold storage for log archival and cost optimization with Last9

Source: https://last9.io/docs/control-plane-cold-storage/

Automatically archive logs older than 14 days to S3 for cost-effective storage and on-demand rehydration. You can configure cold storage for all services or only specific services.

:::note
The default log retention period in Last9 is 14 days. To modify this retention period for your specific needs, please reach out to our support team at support@last9.io.
:::

## Setup

1. **Create IAM Role** with permissions to the S3 bucket:

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Action": [
           "s3:PutObject",
           "s3:GetObject",
           "s3:ListBucket",
           "s3express:CreateSession"
         ],
         "Resource": [
           "arn:aws:s3:::<YOUR_BUCKET_NAME>",
           "arn:aws:s3:::<YOUR_BUCKET_NAME>/*"
         ]
       }
     ]
   }
   ```

2. **Add Trust Relationship**:

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Principal": {
           "Service": "s3.amazonaws.com",
           "AWS": "arn:aws:iam::<LAST9_STORAGE_USER>"
         },
         "Action": "sts:AssumeRole"
       }
     ]
   }
   ```

3. Make sure that the role session expiry is set to **minimum 4 hours**.
   :::note
   Contact Last9 support for LAST9_STORAGE_USER ARN.
   :::

4. **Enable Cold Storage**
   Navigate to the **Buckets** tab in [Cold Storage](https://app.last9.io/control-plane/cold-storage) and add your bucket name and role ARN.

   ![Cold Storage Buckets](../../../.././../../assets/content/docs/control-plane/storage/cold-storage/cold-storage-buckets.png)

5. Once the cold storage is enabled, you can rehydrate the logs on demand. Read the [Rehydration](/docs/control-plane-rehydration/) guide for more details.

## Service-Level Backup Configuration

Navigate to the **Backups** tab in [Cold Storage](https://app.last9.io/control-plane/cold-storage) to configure which services you want to back up.

You have three options:

1. **Default (toggle off):** Data is backed up at index-level granularity only — you cannot rehydrate individual services.
2. **All Services:** Enable the **Service Level Backup** toggle and select **All Services**. All services are backed up and you can rehydrate individual services.

   ![Cold Storage - All Services](../../../.././../../assets/content/docs/control-plane/storage/cold-storage/cold-storage-all-services.png)

3. **Only Selected Services:** Enable the **Service Level Backup** toggle, select **Only Selected Services**, and pick the specific services you want to back up.

   ![Cold Storage - Configure Services](../../../.././../../assets/content/docs/control-plane/storage/cold-storage/cold-storage-configure-services.png)

Click **Save Configuration** after making your selection.

:::note
While creating a Rehydrated Index, if service-level backup is available for your selected time range, you can choose which specific services to rehydrate.
:::

### Benefits of Service-Level Backup

- **Targeted cost optimization:** Save money where it makes sense without compromising on critical services
- **Service-appropriate retention:** Match data lifecycle to each service's actual needs
- **Strategic resource allocation:** Invest observability resources based on service priority
- **Simplified compliance:** Apply different retention rules only where legally necessary

---

## Troubleshooting

Need help? Join our [Discord](https://discord.com/invite/Q3p2EEucx9) or email [support@last9.io](mailto:support@last9.io).
