S3 configuration
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.
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.
Open your command-line interface (CLI), such as Terminal on macOS or Command Prompt on Windows.
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"]
}
]
}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:
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.
Open your command-line interface (e.g., Terminal on macOS or Command Prompt on Windows).
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/*"
}
]
}
Replace
<bucket-name>
with the name of your S3 bucket.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.