aws / aws/aws-cdk

Add users to DocumentDB via constructor [@aws-cdk/aws-docdb]

Open
#11,600 2 comments 18 reactions 0 assignees View on GitHub
@aws-cdk/aws-docdb effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Feature description

Ability to create DocumentDB users via `DatabaseCluster` constructor

### Use Case

The main reason is separation of concerns. Master user has root access, it could be too dangerous for clients to use root user. We would like to have user with read/write rights only for database clients.

### Proposed Solution

Add additional parameter `users` to `DatabaseCluster` constructor. Example of usage:

```
import { DatabaseCluster } from '@aws-cdk/aws-docdb';

new DatabaseCluster(this, 'Cluster Name', {
masterUser: {
username: 'super-power'
},
users: [{
username: 'api',
pwd: 'maga2020',
db: 'admin',
roles: [{ db: 'db-name', role: 'readWrite' }]
}]
);
```

Parameters name and structure of object inspired by [mongo shell documentation](https://docs.mongodb.com/manual/reference/method/db.createUser/), I don't have strong preference related to naming or structure.

### This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Start at the DatabaseCluster constructor in the @aws-cdk/aws-docdb package and review its existing masterUser configuration. Define how the proposed users and roles structure should map to DocumentDB, then verify that clients can receive non-root read/write access while the master user remains separate.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.