# Enable Redshift imports

{% hint style="danger" %}
**This documentation is for the CARTO Self-Hosted Legacy Version**. Use only if you've installed this specific version. Explore our latest documentation for updated features.
{% endhint %}

To import data into Redshift through CARTO Self-Hosted, follow these step-by-step instructions.

{% hint style="danger" %}
This requires access to an AWS account and an existing accessible Redshift endpoint.
{% endhint %}

1. **Create an AWS IAM user with programmatic access**. Take note of the user's ARN, Key ID and Key secret.
2. **Create an AWS S3 Bucket**:
   * ACLs should be allowed.
   * If server-side encryption is enabled, the user must be granted with permissions over the KMS key following the [AWS documentation](https://repost.aws/knowledge-center/s3-bucket-access-default-encryption).
3. **Create an AWS IAM role with the following settings**:

   1. Trusted entity type: `Custom trust policy`.
   2. Custom trust policy: Make sure to replace `<your_aws_user_arn>`.

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
         {
             "Effect": "Allow",
             "Principal": {
                 "AWS": "<your_aws_user_arn>"
             },
             "Action": [
                 "sts:AssumeRole",
                 "sts:TagSession"
             ]
         }
     ]
   }
   ```

   3. Add permissions: Create a new permissions' policy, replacing `<your_aws_s3_bucket_name>`.

   ```json
   {
      "Version": "2012-10-17",
      "Statement": [
          {
              "Effect": "Allow",
              "Action": "s3:ListBucket",
              "Resource": "arn:aws:s3:::<your_aws_s3_bucket_name>"
          },
          {
              "Effect": "Allow",
              "Action": "s3:*Object",
              "Resource": "arn:aws:s3:::<your_aws_s3_bucket_name>/*"
          }
      ]
   }
   ```
4. **Configure your CARTO Self-Hosted deployment**:\\

   Add the following lines to your <mark style="color:orange;">customer.env</mark> file:

   ```
   IMPORT_AWS_CUSTOM_BUCKET_ROLE_ARN='<AWS_CUSTOM_ROLE_ARN>'
   IMPORT_AWS_ACCESS_KEY_ID='<AWS_ACCESS_KEY_ID>'
   IMPORT_AWS_SECRET_ACCESS_KEY='<AWS_ACCESS_KEY_SECRET>'
   ```
5. **Update your installation to apply the changes**.
6. **Configure Redshift Integration in CARTO:**
   1. Log into your CARTO Self-Hosted, go to `Data Explorer > Connections > Add new connection` and create a new Redshift connection.
   2. Then go to `Settings > Advanced > Integrations > Redshift > New`, introduce your S3 Bucket name and region and copy the policy generated.
   3. From the AWS console, go to your `S3 > Bucket > Permissions > Bucket policy` and paste the policy obtained in the previous step in the policy editor.
   4. Go back to the CARTO Self-Hosted (Redshift integration page) and check the `I have already added the S3 bucket policy` box and click on the `Validate and save button`.
   5. Go to `Data Exporer > Import data > Redshift connection` and you should be able to import a local dataset to Redshift.
7. **Import Data to Redshift:**
   1. Go to Data Explorer > Import data > Redshift connection. Now, you should be able to [import a local dataset to Redshift](/carto-user-manual/data-explorer/importing-data.md)! :tada:


---

# 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-self-hosted/carto-self-hosted-legacy/guides/enable-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.
