Cancel/Undo A Pending Modifcation On AWS RDS - 2020-01-06
Canceling a pending modification isn’t described all that well in the AWS documentation, so gave it a try and wrote it down.
I tested it multiple times with RDS/Aurora instances and it works as expected,
even without the --apply-immediately
parameter (at least for the instance
class modifications).
Full Example
Let’s change the instance class for an Aurora instance called
database-2-instance-1
from db.t3.medium
to db.r4.large
and undo it again
afterwards. None of these commands do impact the availability of the database.
Note: Using jq
here to only output the important parts.
Check instance class
aws rds describe-db-instances --db-instance-identifier database-2-instance-1 | jq '.DBInstances[].DBInstanceClass'
"db.t3.medium"
Validate that there is no pending modification
aws rds describe-db-instances --db-instance-identifier database-2-instance-1 | jq '.DBInstances[].PendingModifiedValues'
{}
Modify instance class
This modification will result in a change of the instance class in the next maintenance window.
aws rds modify-db-instance --db-instance-identifier database-2-instance-1 --db-instance-class db.r4.large | jq '.DBInstance.PendingModifiedValues'
{
"DBInstanceClass": "db.r4.large"
}
Validate again
Just to be sure, check if everything looks as expected.
aws rds describe-db-instances --db-instance-identifier database-2-instance-1 | jq '.DBInstances[].PendingModifiedValues'
{
"DBInstanceClass": "db.r4.large"
}
Undo modify of instance class
This is the important part which modifies the instance class back to the old
value. The documentation describes that a --apply-immediately
is required, but
it turns out that that is not the case. At least in this example.
aws rds modify-db-instance --db-instance-identifier database-2-instance-1 --db-instance-class db.t3.medium | jq '.DBInstance.PendingModifiedValues'
{}
Validate the removed pending modification
aws rds describe-db-instances --db-instance-identifier database-2-instance-1 | jq '.DBInstances[].PendingModifiedValues'
{}
At this point the pending modification is gone.