0
0

More than 3 years have passed since last update.

Amazon RDS DB (Aurora)インスタンスタイプを変更するスクリプト

Last updated at Posted at 2020-12-06

Amazon Auroraを社内で検証中…

スケールアップしたときのパフォーマンスを見てみたいな。インスタンスタイプ変えておいて!

 

いや…スケールダウンして、違うパターンも試してみよう…!

なんてことが繰り返されていて、そのたびに AWS Console をポチポチしながらインスタンスタイプを変えていました。。。

(16個変えるのに20分以上マウス操作…)

00rdm.png

さすがに面倒なのでドキュメントを参考に、一括変更できるスクリプトを作りました。

modifyInstance.sh
#!/bin/bash

INSTANCE_CLASS=db.r5.large

aws rds modify-db-instance \
        --db-instance-identifier main-core \
        --db-instance-class $INSTANCE_CLASS \
        --apply-immediately

for (( i=1; i<= 15; i++ ))
do
 id="0${i}"

 aws rds modify-db-instance \
        --db-instance-identifier read${id: -2} \
        --db-instance-class $INSTANCE_CLASS \
        --apply-immediately
done

ドキュメントに記載されている [すぐに適用] 設定を使用する を設定するとスクリプトを実行した直後からインスタンスタイプの変更が始まるので、検証作業中にとても便利です。

0
0
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
0
0