(aws-rds): DatabaseCluster should default `auto_minor_version_upgrade` to `False` if engine version is pinned
See original GitHub issueThis may not be truly a bug, but it is not an ideal setup.
When using aws_rds.DatabaseCluster
, I had a failing over-the-top deploy yesterday because the Aurora PostgreSQL version had been upgraded outside of the CFN stack. I was unaware that this was a behaviour, especially as I had specifically targeted a version of PostgreSQL.
I eventually realised there is the flag auto_minor_version_upgrade
which I’d not set, but I noticed that its default value is True
.
What I think would be more user friendly is if this value defaults to False
if engine
has a version specified.
Reproduction Steps
from aws_cdk import aws_rds
# Specify an RDS Cluster with a Version set like so
aws_rds.DatabaseCluster(
self,
id="rds-cluster",
engine=aws_rds.DatabaseClusterEngine.aurora_postgres(
version=aws_rds.AuroraPostgresEngineVersion.VER_10_12
),
...
)
...
What did you expect to happen?
Deploying the stack without further changes to the DatabaseCluster
construct would result in a successful deploy.
What actually happened?
The deploy failed with the following error message:
23/42 |4:47:39 PM | UPDATE_FAILED | AWS::RDS::DBInstance | prod-downloader-rds/Instance2 (proddownloaderrdsInstance2BE42B470) The specified DB Instance is a member of a cluster. Modify the DB engine version for the DB Cluster using the ModifyDbCluster API (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: fe271c1d-16c8-4acf-928e-dd93574d7ac4; Proxy: null)
createInstances (/tmp/jsii-kernel-0VxvEJ/node_modules/@aws-cdk/aws-rds/lib/cluster.js:360:26)
\_ new DatabaseCluster (/tmp/jsii-kernel-0VxvEJ/node_modules/@aws-cdk/aws-rds/lib/cluster.js:201:34)
\_ /tmp/tmpbizvy7oq/lib/program.js:8154:58
\_ Kernel._wrapSandboxCode (/tmp/tmpbizvy7oq/lib/program.js:8582:24)
\_ Kernel._create (/tmp/tmpbizvy7oq/lib/program.js:8154:34)
\_ Kernel.create (/tmp/tmpbizvy7oq/lib/program.js:7895:29)
\_ KernelHost.processRequest (/tmp/tmpbizvy7oq/lib/program.js:9479:36)
\_ KernelHost.run (/tmp/tmpbizvy7oq/lib/program.js:9442:22)
\_ Immediate._onImmediate (/tmp/tmpbizvy7oq/lib/program.js:9443:46)
\_ processImmediate (internal/timers.js:461:21)
When I checked the RDS Console, I could indeed see that even though my Stack was deployed with 10_12
as the version, it had been upgraded from underneath me to 10_14
, breaking my deployment.
Environment
- CDK CLI Version: 1.105.0 (build 4813992)
- Framework Version: 1.105.0
- Node.js Version: v12.22.1
- OS: Ubuntu 20.04.2
- Language (Version): Python 3.8.6
Other
Following on from a discussion with @skinny85 here https://cdk-dev.slack.com/archives/C018XT6REKT/p1625763866267400
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
@moltar yeah, looks like auto upgrading minor version is not yet supported in cloud formation itself.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbcluster.html
And to piggyback on this issue.
Is there a setting for this for Aurora Serverless as well?
I checked the constructs and the Serverless one has no such options at all.
Non-serverless:
https://github.com/aws/aws-cdk/blob/283ed02c64f827161edba3e11c3cead3b54b7ee9/packages/%40aws-cdk/aws-rds/lib/cluster.ts#L719
Serverless:
https://github.com/aws/aws-cdk/blob/283ed02c64f827161edba3e11c3cead3b54b7ee9/packages/%40aws-cdk/aws-rds/lib/serverless-cluster.ts#L440-L457