LoginSignup
1
3

More than 1 year has passed since last update.

AWS CLI を使用して RDS の「保留中のメンテナンス」をまとめて適用する方法

Last updated at Posted at 2022-11-22

準備

あらかじめ AWS CLI に SSO でログインしておきます。
https://qiita.com/gorooe/items/5e20e261693417f723b3

対象 RDS のリストアップ

保留中のメンテナンスがある RDS の arn を AWS CLI でリストアップします。

aws rds describe-pending-maintenance-actions \
    --profile amimoto-ap-northeast-1 \
    | jq -r '.PendingMaintenanceActions[].ResourceIdentifier'

コマンドでメンテナンスを適用

RDS の arn を指定し、以下を実行します。
RDS の台数分だけ arn とリージョンを変更し実行します。

aws rds apply-pending-maintenance-action \
    --resource-identifier RDS-arn \
    --apply-action system-update \
    --opt-in-type next-maintenance \
    --profile RDS-region

--opt-in-typeオプションにnext-maintenanceを設定していますが、こうすることで次のメンテナンスウィンドウで適用してくれます。
immediateを設定するとコマンド実行と共にアップデートが即適用されます。

immediateで即適用の場合、再起動がかかる場合があるので注意しましょう。

シェルスクリプトを作成すればまとめて実行できます。

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3