# Configuring S3 Bucket for Redshift Imports

If you navigate to **Settings > Advanced Settings > Integrations**, you'll find a setting related to configuring your own S3 bucket to import files into Redshift.

<figure><img src="/files/e8iAKyfw7MURTzmTXvih" alt=""><figcaption></figcaption></figure>

## When is this needed?

To import geospatial files seamlessly into your own Amazon Redshift data warehouse, CARTO needs to use an S3 bucket as a middle step, as required by Redshift.

{% hint style="info" %}
In **CARTO Cloud** organizations this setting is optional because we provide a pre-configured S3 bucket at all times.

* The import feature will always be enabled for Redshift
* You can use this setting to customize and force the imports to use your own S3 Bucket
  {% endhint %}

{% hint style="warning" %}
In **CARTO Self-Hosted** organizations you need to configure this setting to be able to import geospatial files into Redshift using CARTO.
{% endhint %}

Remember that to configure this setting, you previously need to create an S3 bucket in AWS. We recommend you use a fresh new bucket exclusively for this purpose.

## Setting up your S3 bucket

<figure><img src="/files/uE562lmcytHtVtdqcSxh" alt=""><figcaption></figcaption></figure>

First, click on "+ Add" to begin the process. Once inside, tell us the **Bucket name** and the **Region** of the S3 Bucket you want to use when importing files.

{% hint style="warning" %}
This S3 bucket needs to be **located in the same region as your Amazon Redshift cluster**.
{% endhint %}

<figure><img src="/files/XADEjusPuD9IhpNKSOSK" alt=""><figcaption></figcaption></figure>

Once you've added the name and region, click on **Generate policy.** This will generate a policy in the code block on the left side, and you should be able to copy it.

<figure><img src="/files/0FhFi41WXYBbHx2wmhcQ" alt=""><figcaption></figcaption></figure>

## Adding the bucket policy in AWS

{% hint style="info" %}
This step is done in the AWS console. You'll need admin access to the bucket configuration. If you don't have it, just forward an admin these instructions.

[The official documentation from AWS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/add-bucket-policy.html) covers how to add policies and modify other settings mentioned here.
{% endhint %}

1. Copy and **paste the policy** generated by CARTO into the policies of your S3 Bucket in AWS.
2. Make sure **ACLs are allowed**. This is a must for CARTO to use your S3 bucket.
3. Your S3 Bucket can use **encryption** but it needs to be managed by AWS.
4. Additionally, you must add a **Cross-origin resource sharing (CORS)** policy (under the Permissions tab), like the one below. Please replace `*.app.carto.com` by your specific tenant domain in Self-Hosted deployments.

{% code overflow="wrap" %}

```
[ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "PUT" ], "AllowedOrigins": [ "https://*.app.carto.com" ], "ExposeHeaders": [ "ETag" ], "MaxAgeSeconds": 0 } ]
```

{% endcode %}

## Validate and save

Once you've finished the configuration in AWS, go back to CARTO. Mark the *"I have already added the S3 bucket policy"* checkbox as done and click on "**Validate and Save**"

<figure><img src="/files/u4oSfTcLEgufiNpnlsyx" alt=""><figcaption></figcaption></figure>

CARTO will validate your configuration at this point. If we're able to use your S3 bucket to import files into Redshift, we'll take you back to your Settings page.

{% hint style="success" %}
From this point, CARTO will always use your S3 bucket when importing, and the import feature will be enabled if it wasn't before
{% endhint %}

You can edit or remove this integration at any time.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/carto-user-manual/settings/advanced-settings/configuring-s3-bucket-for-redshift-imports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
