In order for Typebot to store your uploaded files, you need to configure an S3 bucket.

You can use any S3-compatible storage provider. Here are some examples:

If you are self-hosting using Docker, you can follow the docker-specific instructions to run a local S3-compatible storage server.

To function properly, your S3 bucket must have the following configuration:

  • CORS policy:

    {
      "CORSRules": [
        {
          "AllowedHeaders": ["*"],
          "AllowedMethods": ["PUT", "POST"],
          "AllowedOrigins": ["*"],
          "ExposeHeaders": ["ETag"]
        }
      ]
    }
    
  • Access policy (replace <bucket-name> with the name of your S3 bucket):

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "PublicRead",
          "Effect": "Allow",
          "Principal": "*",
          "Action": "s3:GetObject",
          "Resource": "arn:aws:s3:::<bucket-name>/public/*"
        }
      ]
    }
    

How to set up CORS policy?

Some S3 providers like AWS provide a user interface that allows you to directly enter a bucket policy. However, other providers might not provide such an interface. In this case, you can set up the CORS policy from the command line.

  1. Make sure you have the AWS CLI (Command Line Interface) installed and configured on your machine. If you haven’t done so already, refer to the official AWS CLI documentation for installation and configuration instructions.

  2. Open your command-line interface (CLI), such as Terminal on macOS or Command Prompt on Windows.

  3. Create a JSON file (e.g., cors-policy.json) that contains the desired CORS policy. Here’s an example CORS policy that allows GET requests from all origins (*):

    {
      "CORSRules": [
        {
          "AllowedHeaders": ["*"],
          "AllowedMethods": ["PUT", "POST"],
          "AllowedOrigins": ["*"],
          "ExposeHeaders": ["ETag"]
        }
      ]
    }
    
  4. Run the following command, replacing <bucket-name> with the name of your S3 bucket and <path-to-policy> with the file path to your JSON CORS policy file:

    aws s3api put-bucket-cors --bucket <bucket-name> --cors-configuration file://<path-to-policy>
    

    When the command is executed successfully, AWS will respond with the JSON representation of the CORS configuration. This indicates that the CORS policy has been applied to your S3 bucket.

    Note: Ensure that you have the appropriate AWS credentials and permissions to perform this action.

How to set up Access policy?

Some S3 providers like AWS provide a user interface that allows you to directly enter a bucket policy. However, other providers like DigitalOcean do not provide such a user interface. In this case, you can set up a bucket policy from the command line.

To set up an S3 bucket policy from the command line, you can use the AWS Command Line Interface (CLI). Here’s a step-by-step guide:

  1. Install and configure the AWS CLI on your machine if you haven’t done so already. You can refer to the official AWS CLI documentation for instructions on installation and configuration.

  2. Open your command-line interface (e.g., Terminal on macOS or Command Prompt on Windows).

  3. To set up a bucket policy, you need the policy document in JSON format. Create a JSON file (e.g., bucket-policy.json) containing the desired policy. Here’s an example policy that allows Public read access for all objects within the bucket:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicRead",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::<bucket-name>/public/*"
    }
  ]
}
  1. Replace <bucket-name> with the name of your S3 bucket.

  2. Run the following command, replacing <bucket-name> with the name of your S3 bucket and <path-to-policy> with the file path to your JSON policy document:

    aws s3api put-bucket-policy --bucket <bucket-name> --policy file://<path-to-policy>
    

    After running the command, AWS will respond with the policy’s JSON representation if the operation is successful. You should see the response output confirming the policy has been added to the bucket.