RDS のパラメータグループ削除が InvalidDBParameterGroupState で失敗するときの対処方法

2024.03.28

困っていた内容

不要な RDS のパラメータグループを削除したいです。
AWS CLI のdelete-db-parameter-groupコマンドで削除を実施したところ、一部パラメータグループがInvalidDBParameterGroupStateで失敗しました。 なぜでしょうか。

$ aws rds delete-db-parameter-group \
    --db-parameter-group-name hato-parameter-group   

An error occurred (InvalidDBParameterGroupState) when calling the DeleteDBParameterGroup operation: One or more database instances are still members of this parameter group hato-parameter-group, so the group cannot be deleted

どう対応すればいいの?

パラメータグループの利用状況を確認してください。

Amazon RDS のパラメータグループは DB インスタンスに関連付けられている場合、InvalidDBParameterGroupStateで削除できません。

そのため、パラメータグループの利用状況を確認して、必要に応じて DB インスタンスのパラメータグループを変更、再度削除をお試しください。

なお、パラメータグループの変更方法は次のブログも参考になると思います。

使用中のリソースを確認する方法

確認したいパラメータグループを選択

「割り当てられたリソース」セクションからパラメータグループを使用するリソースが確認できます。

参考資料

InvalidDBParameterGroupState

The DB parameter group is in use or is in an invalid state. If you are attempting to delete the parameter group, you can't delete it when the parameter group is in this state.

ただし、RDS インスタンス等に関連付けられているパラメータグループおよび、デフォルトパラメータグループは削除できません。

DB インスタンスのパラメータグループの変更方法