> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecompiler.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Storage

> Configure Amazon S3 so people can upload images and documents in conversations.

This guide walks through configuring Amazon S3 storage for your instance, which turns on file uploads (images and documents) in conversations.

## Prerequisites

* An AWS account
* An S3 bucket, or permission to create one
* IAM permissions to create users and policies

## Step 1: Create an S3 bucket

1. Open the [Amazon S3 console](https://console.aws.amazon.com/s3)

2. Click **Create bucket**

3. Configure the bucket:

   | Setting | Recommended value |
   | - | - |
   | **Bucket name** | A unique name (for example `yourcompany-compiler-files`) |
   | **AWS Region** | The region closest to your instance |
   | **Block all public access** | Enabled (keep the default) |
   | **Bucket Versioning** | Disabled (optional) |
   | **Default encryption** | SSE-S3 (default) |

4. Click **Create bucket**

## Step 2: Create an IAM policy

1. Go to the [IAM console](https://console.aws.amazon.com/iam) > **Policies** > **Create policy**

2. Select the **JSON** tab and paste:

   ```json theme={null}
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Sid": "CompilerStorageAccess",
         "Effect": "Allow",
         "Action": [
           "s3:PutObject",
           "s3:GetObject"
         ],
         "Resource": "arn:aws:s3:::YOUR_BUCKET_NAME/*"
       }
     ]
   }
   ```

   Replace `YOUR_BUCKET_NAME` with your bucket name.

3. Click **Next**

4. Name the policy (for example `CompilerStorageAccess`)

5. Click **Create policy**

## Step 3: Create an IAM user

1. Go to **IAM** > **Users** > **Create user**
2. Enter a username (for example `compiler-storage`)
3. Click **Next**
4. Select **Attach policies directly**
5. Search for and select your policy (`CompilerStorageAccess`)
6. Click **Next** > **Create user**

## Step 4: Create access keys

1. Click the user you just created
2. Go to the **Security credentials** tab
3. Under **Access keys**, click **Create access key**
4. Select **Application running outside AWS**
5. Click **Next** > **Create access key**
6. Save these credentials securely:
   * Access key ID: `AKIA...`
   * Secret access key: `wJalrXUtnFEMI...`

<Warning>
  The secret access key is only shown once. Download the CSV or copy it now.
</Warning>

## Step 5: Configure Compiler

1. Log in to your instance as an admin

2. Go to **Settings** > **Storage** (or `/settings/storage`)

3. Enter your configuration:

   | Field | Value |
   | - | - |
   | **Bucket Name** | Your S3 bucket name (for example `yourcompany-compiler-files`) |
   | **Region** | The AWS region of your bucket (for example `us-east-1`) |
   | **Access Key ID** | Your IAM user access key |
   | **Secret Access Key** | Your IAM user secret key |

4. Click **Save Configuration**

## Verify

1. Open any conversation
2. Upload a file (an image or document) with the file attachment button
3. Confirm the file appears in the conversation

If the upload succeeds, storage is configured correctly.

## Remove the configuration

1. Go to **Settings** > **Storage**
2. Click **Remove**
3. Confirm the removal when prompted

<Warning>
  After you remove the storage configuration, previously uploaded files are no longer accessible.
</Warning>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Access denied (403)">
    1. Verify your IAM policy includes both `s3:PutObject` and `s3:GetObject`
    2. Confirm the policy `Resource` matches your bucket name exactly (`arn:aws:s3:::YOUR_BUCKET/*`)
    3. Check that the access key ID and secret access key are correct
  </Accordion>

  <Accordion title="Invalid bucket name">
    1. Make sure the bucket name matches exactly, with no leading or trailing spaces
    2. Confirm the bucket exists in the specified region
  </Accordion>

  <Accordion title="Wrong region">
    1. The region must match where your bucket was created (for example `us-east-1` or `eu-west-1`)
    2. Check your bucket's region in the S3 console under **Properties**
  </Accordion>

  <Accordion title="Upload fails with a network error">
    1. Verify your instance can reach `your-bucket.s3.your-region.amazonaws.com`
    2. Check that no firewall or proxy is blocking outbound HTTPS traffic to AWS
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.