Last active
April 4, 2024 09:36
-
-
Save bishwanathjha/e4ba34a8b736e4a61203ecd1e553d4c8 to your computer and use it in GitHub Desktop.
Parse the output of aws describe-db-engine-versions and display SupportsCertificateRotationWithoutRestart flag per engine version
This file contains 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
// Modify the DB instance or Multi-AZ DB cluster to change the CA from rds-ca-2019 to rds-ca-rsa2048-g1 or others. | |
// To check if your database requires a restart to update the CA certificates, | |
// use the describe-db-engine-versions command and check the SupportsCertificateRotationWithoutRestart flag. | |
// Below command parse the output from describe-db-engine-versions and print line per engine version with SupportsCertificateRotationWithoutRestart flag | |
// Change the "aurora-mysql" and "eu-central-1" according to your use case | |
// https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL-certificate-rotation.html#UsingWithRDS.SSL-certificate-rotation-updating | |
aws rds describe-db-engine-versions \ | |
--engine aurora-mysql --include-all --region eu-central-1 | \ | |
jq -r '.DBEngineVersions[] | "EngineName: \(.Engine), EngineVersion: \(.EngineVersion), SupportsCertificateRotationWithoutRestart: \(.SupportsCertificateRotationWithoutRestart), SupportedCAs: \(.SupportedCACertificateIdentifiers | join(", "))"' | |
Output sample: | |
------------- | |
EngineName: aurora-postgresql, EngineVersion: 15.3, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-postgresql, EngineVersion: 15.4, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-postgresql, EngineVersion: 15.5, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-postgresql, EngineVersion: 16.1, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-mysql, EngineVersion: 8.0.mysql_aurora.3.05.0, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-mysql, EngineVersion: 8.0.mysql_aurora.3.05.1, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-mysql, EngineVersion: 8.0.mysql_aurora.3.05.2, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
EngineName: aurora-mysql, EngineVersion: 8.0.mysql_aurora.3.06.0, SupportsCertificateRotationWithoutRestart: true, SupportedCAs: rds-ca-2019, rds-ca-ecc384-g1, rds-ca-rsa4096-g1, rds-ca-rsa2048-g1 | |
# Check what is there in pending modification, you can see the certificate changes new value | |
aws rds describe-db-instances \ | |
--query 'DBInstances[?DBInstanceIdentifier==`your-db-instance-0`].{InstanceIdentifier:DBInstanceIdentifier, PendingModifiedValues:PendingModifiedValues}' | |
# Apply changes immediately after updating the config | |
aws rds modify-db-instance --db-instance-identifier your-db-instance-0 --apply-immediately |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment