aws / aws/aws-cdk

aws-rds: deprecate writer and readers props for DatabaseCluster

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

Description

### Describe the issue

The props `instances` and `instanceProps` for `rds.DatabaseCluster` are deprecated in favour of `writer` and `readers`.

What is the behaviour of these when the Aurora cluster fails over? If I create a reader, can it become promoted to a writer, or will it always be a reader?

Relevant Aurora docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.AuroraHighAvailability.html#Concepts.AuroraHighAvailability.Instances

> When a problem affects the primary instance, one of these reader instances takes over as the primary instance. This mechanism is known as failover.

Further, assuming they do all just become instances in the cluster, any of which might get promoted to be the writer, what happens on future CDK deployments? I can imagine a situation where I think I'm changing something about the readers, but am actually changing something about all-but-one of the readers _and_ the writer, because:
- the instance CDK thinks of as the writer is now a reader
- the instance that is actually the writer is one of the instances the CDK thinks of as readers

I don't see any discussion around this in https://github.com/aws/aws-cdk/pull/25437, the PR that introduced this.

I might just be missing something, but the structure of this seems at odds with how an Aurora cluster actually behaves.

### Links

CDK docs:
- https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html#writer
- https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseCluster.html#readers
- https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds-readme.html

Aurora failover docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.AuroraHighAvailability.html#Concepts.AuroraHighAvailability.Instances

Contributor guide

Open the contributing guide

Research direction

Start with the aws_rds.DatabaseCluster writer, readers, instances, and instanceProps entry points, then compare their behavior with PR #25437 and the linked Aurora failover documentation. Verify how failover changes writer identity and how later CDK deployments interpret those roles; done when the behavior and deployment implications are resolved and clearly documented.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.