Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbSubnetGroupName should not be specified for read replicas that are created in the same region as the master #5530

Closed
stevensu1977 opened this issue Dec 23, 2019 · 4 comments · Fixed by #5702
Assignees
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. p1

Comments

@stevensu1977
Copy link

stevensu1977 commented Dec 23, 2019

I use DatabaseInstanceReadReplica create replicas in same region as master

DbSubnetGroupName should not be specified for read replicas that are created in the same region as the master

my code:

   avalon_mysql= rds.DatabaseInstance(
            self,
            "WebGMRds",
            master_username='admin',
            master_user_password=core.SecretValue('Welcome1#'),
            engine=rds.DatabaseInstanceEngine.MYSQL,
            vpc=default_vpc,
            instance_class=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM),
            multi_az=True
            )

        rds.DatabaseInstanceReadReplica(
            self,
            "WebGMRDS_ReadReplica",
            engine=rds.DatabaseInstanceEngine.MYSQL,
            vpc=default_vpc,
            instance_class=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM),
            multi_az=False,
            source_database_instance=avalon_rds,
            security_groups=[co_sg]
        )

synth output:

WebGMRDSReadReplicaSubnetGroup657CCA1E:
    Type: AWS::RDS::DBSubnetGroup
    Properties:
      DBSubnetGroupDescription: Subnet group for WebGMRDS_ReadReplica database
      SubnetIds:
        - subnet-68c8b446
        - subnet-dbb2b391
        - subnet-a4d8aaf8
        - subnet-52e49535
        - subnet-1ede5a20
        - subnet-ea8ca7e5
    Metadata:
      aws:cdk:path: avalonRDS04/WebGMRDS_ReadReplica/SubnetGroup

WebGMRDSReadReplicaF67C7A7C:
    Type: AWS::RDS::DBInstance
    Properties:
      DBInstanceClass: db.t3.medium
      CopyTagsToSnapshot: true
      DBSubnetGroupName:
        Ref: WebGMRDSReadReplicaSubnetGroup657CCA1E

Reproduction Steps

Error Log

WebGMRDS_ReadReplica (WebGMRDSReadReplicaF67C7A7C) DbSubnetGroupName should not be specified for read replicas that are created in the same region as the master (Service: AmazonRDS; Status Code: 400; Error Code: DBSubnetGroupNotAllowedFault; Request ID: 0f1315ff-6e8a-4331-85a7-1fd10c2e1a36)

Environment

  • **CLI Version : 1.18.0 (build bc924bc)
  • Framework Version:
  • **OS : osx
  • **Language : python

Other


This is 🐛 Bug Report

@stevensu1977 stevensu1977 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 23, 2019
@stevensu1977
Copy link
Author

I use python/typescript , get same error

@SomayaB SomayaB added the @aws-cdk/aws-rds Related to Amazon Relational Database label Dec 23, 2019
@stevensu1977
Copy link
Author

1.19 have same issue , -_-!

@justengland
Copy link
Contributor

Any progress on this?

@skinny85
Copy link
Contributor

skinny85 commented Jan 7, 2020

Not yet, sorry :( I'll look into this today.

skinny85 added a commit to skinny85/aws-cdk that referenced this issue Jan 8, 2020
…p name filled

Changed the logic in DatabaseInstanceReadReplica to skip the
'dbSubnetGroupName' property if the replica is part of a stack with region
equal to the region of the source instance stack.

Fixes aws#5530
@skinny85 skinny85 added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Jan 8, 2020
skinny85 added a commit to skinny85/aws-cdk that referenced this issue Jan 8, 2020
…eReadReplica

This works around the
"DbSubnetGroupName should not be specified for read replicas that are
created in the same region as the master" RDS validation.

See hashicorp/terraform-provider-aws#528 (comment)
for details.

Fixes aws#5530
@mergify mergify bot closed this as completed in #5702 Jan 8, 2020
mergify bot added a commit that referenced this issue Jan 8, 2020
…eReadReplica (#5702)

This works around the
"DbSubnetGroupName should not be specified for read replicas that are
created in the same region as the master" RDS validation.

See hashicorp/terraform-provider-aws#528 (comment)
for details.

Fixes #5530

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database bug This issue is a bug. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants