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

# AWS Redshift

> Learn how to connect AWS Redshift to Pelanor and get precise database, table, query and user-level cost breakdowns.

## Redshift Integration Overview

This integration supports **multiple clusters** in a single account and region (filter-in / filter-out supported). It works by periodically unloading Redshift system-table contents into Pelanor’s S3 bucket, which Pelanor then reads using its IAM role.

<Warning>
  The integration requires the <strong>master user and password</strong> to unload certain system tables and views.\
  These credentials must be stored in an <strong>AWS Secrets Manager</strong> secret in the <strong>same account and region</strong> and tagged as:

  | Tag key  | Tag value          |
  | -------- | ------------------ |
  | Redshift | <i>cluster ARN</i> |

  If your cluster was created with Secrets Manager credentials, the secret and tags are already correct.
</Warning>

<Info>
  Read each step carefully. If you hit issues, see the troubleshooting section or contact Pelanor Support.
</Info>

**Modules included:**

* `redshift-account-onboarding`
* `redshift-cluster-onboarding`

Each module contains its own `README.md` with usage details.

This integration is network-agnostic — it schedules, authenticates, and runs queries via the cloud backbone.\
If you use restrictive IAM/SCP policies, you may need to update them.\
Each scheduled query emits an EventBridge event routed to a CloudWatch Logs group prefixed with `/pelanor/aws/events/redshift/`.

***

## Setup the Terraform Module

<Steps>
  <Step title="Create tfvars">
    Create a file like `production.tfvars` and replace `<bucketname>` with the bucket used by Pelanor’s AWS integration.
  </Step>

  <Step title="Run Terraform">
    From your root module directory, run `terraform apply`.\
    Make sure your AWS provider is set to the correct region and account.
  </Step>

  <Step title="Confirm plan and apply">
    Review the plan and type <code>yes</code> to apply.
  </Step>
</Steps>

For help with provider setup, see the [AWS Provider docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs).

***

## Select Appropriate Bucket

Use the correct bucket name based on your AWS region:

| AWS Region       | Bucket name                       |
| ---------------- | --------------------------------- |
| `us-east-1`      | `pelanor-redshift-us-east-1`      |
| `eu-west-1`      | `pelanor-redshift-eu-west-1`      |
| `ap-southeast-2` | `pelanor-redshift-ap-southeast-2` |

<Warning>
  Choosing the correct bucket is essential — double-check your AWS account region before proceeding.
</Warning>

<Note>
  If your region isn’t listed, contact Pelanor Support.
</Note>

***

## Directory Structure

```txt theme={null}
examples/
  redshift/
    backend.tf
    main.tf
    README.md
    variables.tf
modules/
  redshift-account-onboarding/
    aws_context.tf
    main.tf
    outputs.tf
    README.md
    variables.tf
    versions.tf
  redshift-cluster-onboarding/
    aws_context.tf
    cluster_discovery.tf
    event_logging.tf
    main.tf
    outputs.tf
    README.md
    sql/
      segmented.sql.tftpl
      unsegmented.sql.tftpl
    variables.tf
    versions.tf
```
