Automatically retrieve Redshift cluster credentials
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Is your feature request related to a problem? Please describe.**
The AWS Redshift SDK allows retrieving credentials via an API:
```typescript
import Redshift, { ClusterCredentials } from 'aws-sdk/clients/redshift';
const getCredentials = async () => {
const creds = await redshift.getClusterCredentials({
ClusterIdentifier: process.env.CUBEJS_DB_HOST,
DbUser: process.env.CUBEJS_DB_USER,
}).promise();
if (!creds.DbUser && !creds.DbPassword) {
throw new Error('Unable to retrieve Redshift credentials');
}
return creds as Required;
};
getCredentials()
.then((credentials) => {
const config = {
database : process.env.CUBEJS_DB_NAME,
host: process.env.CUBEJS_DB_HOST,
password : creds.DbPassword,
port: process.env.CUBEJS_DB_PORT,
user: creds.DbUser,
};
})
```
**Describe the solution you'd like**
It would be great if CubeJS would automatically attempt to do the above if the `CUBEJS_DB_PASS` environment variable is omitted for Redshift projects.
**Additional context**
A Serverless project using Redshift would require additional permissions to the IAM role:
```yaml
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'redshift:GetClusterCredentials'
Resource:
- '/'
```
Contributor guide
Assessment
This issue has not been assessed yet.