> For the complete documentation index, see [llms.txt](https://docs.airops.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airops.com/docs/pt/contexto/memory-stores/add-data/import-from-sql-database/data-sources/redshift.md).

# Redshift

Conecte a uma base de dados Redshift no AirOps

{% hint style="info" %}
**Lembre-se de adicionar o nosso endereço IP à allowlist `52.71.87.39`**

Se a sua base de dados estiver protegida por uma firewall, lembre-se de permitir o acesso de entrada ao endereço IP da AirOps através da porta da sua base de dados.
{% endhint %}

1. **Host ou IP** - O endpoint do seu cluster AWS Redshift.\
   Exemplo: `examplecluster.abcdefghijkl.us-west-2.redshift.amazonaws.com`
2. **Porta** - A porta na qual o seu cluster Redshift está a escutar. O valor predefinido é `5439`.
3. **Utilizador** - O utilizador do Redshift com o qual o AirOps se ligará à base de dados. É uma boa prática criar um novo utilizador para o AirOps (instruções abaixo), mas pode ser utilizado qualquer utilizador com privilégios SELECT.
4. **Palavra-passe** - Palavra-passe para o utilizador acima.
5. **Base de Dados** - A base de dados Redshift à qual o AirOps se ligará.

<figure><img src="https://files.readme.io/77bfcd7-image.png" alt="" width="375"><figcaption></figcaption></figure>

## Configurar utilizador e conceder acesso (para novos utilizadores)

Para adicionar uma base de dados AWS Redshift como Fonte de Dados no AirOps, utilize um utilizador existente ou crie um utilizador com **acesso de leitura** acesso às tabelas e esquemas aos quais gostaria de aceder a partir do AirOps:

### 1. Criar utilizador AirOps

```sql
CREATE USER airops_user
PASSWORD '<secure-password>';
```

### 2. Conceder privilégios USAGE e SELECT ao utilizador AirOps

Substitua `<schema>` como no `<table>` pelos nomes adequados do esquema e da tabela com os quais gostaria que o AirOps interagisse.

```sql
GRANT USAGE ON SCHEMA "<schema>" TO airops_user;

GRANT SELECT ON TABLE "<schema>"."<table>" TO airops_user;
```

Se quiser conceder acesso a várias tabelas, pode executar a `GRANT SELECT` instrução para cada tabela.

### 3. (Opcional) Conceder acesso a futuras tabelas no esquema

Se quiser conceder acesso a todas as tabelas futuras num esquema, pode usar o seguinte comando. Substitua pelo nome do esquema apropriado.

```sql
ALTER DEFAULT PRIVILEGES IN SCHEMA "<schema>"
GRANT SELECT ON TABLES TO airops_user;
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.airops.com/docs/pt/contexto/memory-stores/add-data/import-from-sql-database/data-sources/redshift.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
