-
Notifications
You must be signed in to change notification settings - Fork 4k
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
aws-rds: Proxy Target Group does not depend on Writer Instance #31304
aws-rds: Proxy Target Group does not depend on Writer Instance #31304
Comments
Code example used was here: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseProxy.html |
Hi @ServerlessSam , thanks for reaching out. I tried to repro the issue and it succeeded with deployment, using the code shared by you (without adding the dependency statement). please refer to the snapshots here - The resources in Cloudformation - Could you please share the error logs or any more information that might be able to help reproduce the issue ? |
Hey @ServerlessSam , your observation is right on. I checked the cloudformation template in my code and seems like there is a reference in writer instance but no depends-on ias pointed out by you, which might be leading to creation failure causing the race condition. "AuroraCluster23D869C0": {
"Type": "AWS::RDS::DBCluster",
"Properties": {
"CopyTagsToSnapshot": true,
"DBClusterParameterGroupName": "default.aurora-postgresql16",
"DBSubnetGroupName": {
"Ref": "AuroraClusterSubnetsF3E9E6AD"
},
"DatabaseName": "AuroraDB",
"Engine": "aurora-postgresql",
"EngineVersion": "16.2",
"MasterUserPassword": {
"Fn::Join": [
"",
[
"{{resolve:secretsmanager:",
{
"Ref": "ProxyRdsIssueStackAuroraClusterSecretB6AFBD693fdaad7efa858a3daf9490cf0a702aeb"
},
":SecretString:password::}}"
]
]
},
"MasterUsername": "AuroraSecret",
"Port": 5432,
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"AuroraSecurityGroup75F699F6",
"GroupId"
]
}
]
},
"UpdateReplacePolicy": "Snapshot",
"DeletionPolicy": "Snapshot",
"Metadata": {
"aws:cdk:path": "ProxyRdsIssueStack/AuroraCluster/Resource"
}
},
"AuroraClusterwriter499C523E": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"DBClusterIdentifier": {
"Ref": "AuroraCluster23D869C0"
},
"DBInstanceClass": "db.t3.medium",
"Engine": "aurora-postgresql",
"PromotionTier": 0,
"PubliclyAccessible": false
},
"DependsOn": [
"AuroraVPCAuroraSubnetSubnet1RouteTableAssociation41962FD0",
"AuroraVPCAuroraSubnetSubnet2RouteTableAssociation76A03163"
],
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete",
"Metadata": {
"aws:cdk:path": "ProxyRdsIssueStack/AuroraCluster/writer/Resource"
}
}, Marking it as P2 as it won't be addressed by team immediately as it has a workaround. |
…en using writer property for database cluster (#31354) ### Issue # (if applicable) Closes #31304 . ### Reason for this change Proxy Target Group should depend on and wait for Aurora instances to be ready before creating CloudFormation resource. (see the issue). Now, the dependency is added when using a legacy `instanceProps`, but not added when using a `writer` property. https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/proxy.ts#L535-L539 (The cluster has `CfnDBInstance` directly when using the `instanceProps`, but it has `AuroraClusterInstance` with `CfnDBInstance` as `defaultChild` when using the `writer`. So the cluster doesn't have the `CfnDBInstance` directly in the latter case.) ### Description of changes Added the dependency when using a `writer` property instead of `instanceProps`. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Comments on closed issues and PRs are hard for our team to see. |
…en using writer property for database cluster (aws#31354) ### Issue # (if applicable) Closes aws#31304 . ### Reason for this change Proxy Target Group should depend on and wait for Aurora instances to be ready before creating CloudFormation resource. (see the issue). Now, the dependency is added when using a legacy `instanceProps`, but not added when using a `writer` property. https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/proxy.ts#L535-L539 (The cluster has `CfnDBInstance` directly when using the `instanceProps`, but it has `AuroraClusterInstance` with `CfnDBInstance` as `defaultChild` when using the `writer`. So the cluster doesn't have the `CfnDBInstance` directly in the latter case.) ### Description of changes Added the dependency when using a `writer` property instead of `instanceProps`. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…en using writer property for database cluster (aws#31354) ### Issue # (if applicable) Closes aws#31304 . ### Reason for this change Proxy Target Group should depend on and wait for Aurora instances to be ready before creating CloudFormation resource. (see the issue). Now, the dependency is added when using a legacy `instanceProps`, but not added when using a `writer` property. https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-rds/lib/proxy.ts#L535-L539 (The cluster has `CfnDBInstance` directly when using the `instanceProps`, but it has `AuroraClusterInstance` with `CfnDBInstance` as `defaultChild` when using the `writer`. So the cluster doesn't have the `CfnDBInstance` directly in the latter case.) ### Description of changes Added the dependency when using a `writer` property instead of `instanceProps`. ### Description of how you validated changes Both unit and integ tests. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
When following documentation for a
DatabaseCluster
I get CloudFormation deployment errorsRegression Issue
Last Known Working CDK Version
No response
Expected Behavior
Proxy Target Group should wait for Aurora writer instance to be ready before creating CloudFormation resource
Current Behavior
Target Group does not wait for Aurora writer instance to be ready before creating CloudFormation resource. The following CloudFormation error is seen as the proxy target group moves to the
CREATE_FAILED
state:Resource handler returned message: "DB Instance <writer instance name> is in an unsupported state - CONFIGURING_ENHANCED_MONITORING, needs to be in [AVAILABLE, MODIFYING, BACKING_UP, CREATING]
Reproduction Steps
Deploy the following CDK (
2.143.0
) (eu-central-1 if you want to match my region)The text was updated successfully, but these errors were encountered: