fix: add pre-flight check for existing aurora databases before restore - #63
Merged
Conversation
Prevents duplicate database creation errors during redeployment by checking AWS for existing RDS instances before attempting to create. - Extract AWS RDS lookup logic into generic helper function - Add pre-flight check in deployAurora() before cli.cliDeploy() - Refactor post-creation lookup to use new helper function This makes Aurora restore operations idempotent and safe to retry.
binlab
approved these changes
Nov 3, 2025
vigneshrajsb
added a commit
to nickh8/lifecycle
that referenced
this pull request
Nov 3, 2025
Combines improvements from both PRs: - Pre-flight check for existing Aurora databases (PR GoodRxOSS#63) - Cluster endpoint usage instead of instance endpoint (PR GoodRxOSS#50) The helper function now uses cluster endpoints for better resilience during instance failures and replacements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes duplicate database creation errors during static environment redeployment by checking AWS for existing RDS instances before attempting to create them.
Problem
When redeploying a static environment, the Aurora restore deploy (
npc-db) attempts to recreate an already-existing RDS database, causing an error. This happens because:DeploymentManagerresets all deploy statuses toQUEUEDbefore deploymentdeployAurora()failscli.cliDeploy()tries to recreate the existing databaseSolution
Added a pre-flight check in
deployAurora()that queries AWS to verify if the RDS database already exists before attempting to create it.Changes
findExistingAuroraDatabase(buildUuid, serviceName)- Generic, reusable function that queries AWS for existing RDS instances by tagscli.cliDeploy(), check if database exists in AWS. If found, skip creation and use existing endpointBenefits
Test Plan