https://docs.aws.amazon.com/ja_jp/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.html
https://dev.classmethod.jp/articles/aurora-serverless-v2-ga/
-- 1. コマンド等のインストール
-- 1.1 aws cli version 2 インストール
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws --version
-- 2. Aurora Serverless v2クラスタの作成
aws rds create-db-cluster \
--db-cluster-identifier cluster01 \
--engine aurora-mysql \
--engine-version 8.0.mysql_aurora.3.02.0 \
--serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=1 \
--master-username root \
--master-user-password 'password' \
--backup-retention 1
aws rds create-db-instance \
--db-cluster-identifier cluster01 \
--db-instance-identifier cluster01-instance01 \
--db-instance-class db.serverless \
--engine aurora-mysql \
--no-auto-minor-version-upgrade \
--no-enable-performance-insights
aws rds create-db-instance \
--db-cluster-identifier cluster01 \
--db-instance-identifier cluster01-instance02 \
--db-instance-class db.serverless \
--engine aurora-mysql \
--no-auto-minor-version-upgrade \
--no-enable-performance-insights
aws rds describe-db-clusters
aws rds describe-db-instances
-- 3. Aurora Serverless v2クラスタ停止/起動
aws rds stop-db-cluster --db-cluster-identifier cluster01
aws rds start-db-cluster --db-cluster-identifier cluster01
-- 4. Aurora Serverless v2インスタンス再起動
aws rds reboot-db-instance --db-instance-identifier cluster01-instance01
-- 5. 手動フェイルオーバ実行
aws rds failover-db-cluster \
--db-cluster-identifier cluster01 \
--target-db-instance-identifier cluster01-instance02
-- 6. クリーンアップ
aws rds delete-db-instance \
--db-instance-identifier cluster01-instance02 \
--skip-final-snapshot
aws rds delete-db-instance \
--db-instance-identifier cluster01-instance01 \
--skip-final-snapshot
aws rds delete-db-cluster \
--db-cluster-identifier cluster01 \
--skip-final-snapshot