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] Availability Zone parameter silently removed from stack when MultiAZ is true

See original GitHub issue

If you have a DB instance created with the availability_zone parameter setted and also set multi_az parameter to true then CDK simply generates the CloudFormation template removing the availability_zone setting because, both parameters cannot be used at the same time.

The issue is that the developer doesn’t have any visibility on that, so suppose that later in another deploy multi_az is setted to false, then CDK will consider the availability_zone parameter and probably try to make a DB instance replacement due to an AZ change.

Reproduction Steps

#!/usr/bin/env python3

from aws_cdk import core

from aws_cdk import (
  aws_ec2 as ec2,
  aws_rds as rds,
  core
)


class Cdk167RdsStack(core.Stack):

  def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
    super().__init__(scope, id, **kwargs)

    vpc = ec2.Vpc.from_lookup(
      self,
      "vpc",
      vpc_id="vpc-xxxxxxxxxxx"
    )

    rds.DatabaseInstance(
      self,
      'DBInstance',
      engine=rds.DatabaseInstanceEngine.postgres(
        version=rds.PostgresEngineVersion.of(
          postgres_full_version="12.3",
          postgres_major_version="12"
        )
      ),
      vpc=vpc,
      availability_zone=vpc.availability_zones[0],
      multi_az=False,
    )

app = core.App()
Cdk167RdsStack(app, "cdk-1-67-rds", env={'region': 'eu-west-1', 'account': 'XXXXXXXXXXXX'})

app.synth()

Then change multi_az to True and synth again.

What did you expect to happen?

If both parameters are setted at the same time, there must be some kind of exception (IncompatibleParameters or something like that) or at least a warning before apply the change.

What actually happened?

No warning or exception is shown to the developer, so he/she cannot be aware about the removal of availability_zone from CloudFormation output template when multi_az is True.

Environment

  • CLI Version : aws-cli/1.18.115 Python/3.8.5 Darwin/19.6.0 botocore/1.17.38 CDK -> 1.67
  • Framework Version: 1.67
  • Node.js Version: v14.7
  • OS : macos 10.15.7
  • Language (Version): Python (3.8.5)

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
neovasilicommented, Jan 2, 2021

Hi Adam,

Thanks for your response. Now I have more free time for it, so even if Typescript is not my primary programming language, I will try it 😄

0reactions
github-actions[bot]commented, May 25, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multi-AZ DB instance deployments - AWS Documentation
In a Multi-AZ DB instance deployment, Amazon RDS automatically provisions and maintains a synchronous standby replica in a different Availability Zone.
Read more >
Amazon RDS Under the Hood: Multi-AZ - AWS
The standby instance and volume are in a distinct and geographically distant Availability Zone. Assessment shows increases in database commit ...
Read more >
Multi-AZ deployments for high availability
Get high availability and failover support for your DB instances with Amazon RDS using a Multi-AZ deployment.
Read more >
Multi-AZ deployments for Amazon RDS for Microsoft SQL ...
Multi -AZ deployments provide increased availability, data durability, and fault tolerance for DB instances. In the event of planned database maintenance or ...
Read more >
Multi-AZ Deployments For Enhanced Availability & Reliability
To be more specific, when you launch a DB Instance with the Multi-AZ parameter set to true, Amazon RDS will create a primary...
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