-
Notifications
You must be signed in to change notification settings - Fork 89
Aurora upgrade cdk build #1759
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
Aurora upgrade cdk build #1759
Conversation
| '/usr/lib/postgresql/$SRC_PGVER/bin/pg_dump -x -Fc -v > db.dump', | ||
| 'export PGHOST=$TGT_HOST PGPORT=$TGT_PORT PGUSER=$TGT_USER PGPASSWORD=$TGT_PWD', | ||
| '/usr/lib/postgresql/$TGT_PGVER/bin/pg_isready', | ||
| '/usr/lib/postgresql/$TGT_PGVER/bin/pg_restore -v -x -O -C -c -d postgres db.dump', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-cclean will DROP objects that will be restored-Cwill create the database (not sure what happens if it already exists)- The combination of two flags will DROP and RECREATE the entire db
I am a bit concerned that customers might rerun this job after they have migrated and the two dbs have diverged something that will effectively restore the target db to the point in time of the old db.
Perhaps I am overthinking it but is there anything we can do to prevent this?
I think we need the -c because db_migrations trigger func will run after the deployment of the new cluster and will "pollute" the database. But maybe we don't need the -C because you already create the default database in CDK. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new cluster is created with DB in it and also, smth (e.g. permissions) is already there. So, it's easier and safer to drop everything and restore. It works the second time as well.
This code will give us a copy of old DB in new cluster. Thats' exactly what we need.
It's not a 'normal' thing to do, so I think that's the best option.
Feature or Bugfix
Detail
cdk.jsontoDeploymentEnvironmentssectionCopy source DB connection secret before deploing! That's going to be
old_aurora_connection_secret_arnUpgrade Recommendations
Once deployed it will create a new v2 cluster with an empty database and a CodeBuild job that when it runs (manual trigger) will copy the data from the old cluster to the new one. Using the CodeBuild job is provided as a helper and is not mandatory to be used. Users can opt to perform the copy using their own scripts.
Suggested steps
IMPORTANT!
Relates
Security
Please answer the questions below briefly where applicable, or write
N/A. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
evalor similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.