Open TimQuist opened 1 year ago
Specifying the instance identifier will be the solution.
However this creates a problem when deploying on multiple environments, the identifier of the reader and writer might differ on different environments due to a failover happening.
The only thing you need to be concerned with is CloudFormation's view of the world. CloudFormation will not know about any failover, so it will only apply any new changes with respect to CloudFormation's own previous configuration (emphatically, not the actual state of the world). In this case, since its previous template and its current template will be the same, it will not change anything.
What will happen when you do intend to make a change via CloudFormation after a failover has happened ... I actually do not know. If it turns out that managing RDS via CloudFormation is not reliable, that's something you should take up with the RDS and/or CloudFormation teams.
Specifying the instance identifier will be the solution.
However this creates a problem when deploying on multiple environments, the identifier of the reader and writer might differ on different environments due to a failover happening.
The only thing you need to be concerned with is CloudFormation's view of the world. CloudFormation will not know about any failover, so it will only apply any new changes with respect to CloudFormation's own previous configuration (emphatically, not the actual state of the world). In this case, since its previous template and its current template will be the same, it will not change anything.
What will happen when you do intend to make a change via CloudFormation after a failover has happened ... I actually do not know. If it turns out that managing RDS via CloudFormation is not reliable, that's something you should take up with the RDS and/or CloudFormation teams.
Thanks, can verify that this works. We have a PROD environment with this exact situation. The cdk diff
indeed does not specify anything about replacement as long as you keep the instanceIdentifier
the same as specified in the Cloudformation template.
Should there be any further specification of this in the docs so others don't face the same issue as me?
@rix0rrr We just hit this bug as well. Essentially the isFromLegacyInstanceProps
flag is useless as-is. We shouldn't have to manually specify the instance identifiers - that flag should force it to generate them the same way it used to.
Describe the bug
When using the isFromLegacyInstanceProps to migrate my old RDS instance properties from instanceProps to the new method using
reader
andwriter
params, is still flagging my instances for recreation.This would cause my instances to be recreated, and I am curious if this would bring downtime and possibly even get rid of my automated backups.
Expected Behavior
I would except the output of the cdk diff step against my 'test' AWS account to be:
Current Behavior
The current output of cdk diff against my 'test' AWS account using the migration property is:
Reproduction Steps
Old CDK code used to deploy RDS currently on AWS test environment:
New CDK code used to do migration with no functional changes and the migration property:
Possible Solution
Using the method described in https://github.com/aws/aws-cdk/issues/25942 this problem can be solved. However in a non-ideal way.
You can directly specify an
instanceIdentifier
on both the reader and writer. However this creates a problem when deploying on multiple environments, the identifier of the reader and writer might differ on different environments due to a failover happening.Doing this however, will cause
cdk diff
to report what we want:Example:
Additional Information/Context
Also responded on https://github.com/aws/aws-cdk/discussions/25900
CDK CLI Version
2.93.0 (build 724bd01)
Framework Version
No response
Node.js Version
v18.16.0
OS
MacOs
Language
Typescript
Language Version
5.2.2
Other information
Also replied on: https://github.com/aws/aws-cdk/discussions/25900