question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-rds): DatabaseCluster should default `auto_minor_version_upgrade` to `False` if engine version is pinned

See original GitHub issue

This 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:open
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
nohackcommented, Jul 22, 2021

@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

1reaction
moltarcommented, Jul 9, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading a DB instance engine version - AWS Documentation
Using the RDS API, set the AutoMinorVersionUpgrade parameter. To determine whether a maintenance update, such as a DB engine version upgrade, is available...
Read more >
RDS — Boto3 Docs 1.26.37 documentation - Amazon AWS
Provides the version of the database engine for this DB cluster snapshot. ... an RDS Custom DB instance, you must set AutoMinorVersionUpgrade to...
Read more >
cloudposse/terraform-aws-rds-cluster - GitHub
Name Description Type Default allocated_storage The allocated storage in GBs number null allowed_cidr_blocks List of CIDR blocks allowed to access the cluster list(string) autoscaling_enabled Whether to...
Read more >
Resource: aws_db_instance - hashicorp - Terraform Registry
auto_minor_version_upgrade - (Optional) Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window.
Read more >
aws.rds.Instance - Pulumi
Default is false . See Amazon RDS Documentation for more information. autoMinorVersionUpgrade boolean. Indicates that minor engine upgrades will be applied ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found