![](https://batch-file.net/wp-content/themes/cocoon-master/images/b-woman.png)
バッチファイルから
・RDSを開始
できます!
前提
AWS CLIがインストールされていること。
コード
ここでは例として
・DB識別子「sample-rds-postgres」を開始
します。
![DB識別子「sample-rds-postgres」](https://batch-file.net/wp-content/uploads/2024/03/bat_aws_rds_start_cli_001.png)
@echo off
rem DB識別子
set dbIdentifier=sample-rds-postgres
rem プロファイル名
set profile=develop
rem RDSを開始
aws rds start-db-instance --db-instance-identifier %dbIdentifier% --profile %profile% > nul
rem 実行結果を確認
if %errorlevel% == 0 (
echo 正常終了しました。戻り値:%errorlevel%
) else (
echo 異常終了しました。戻り値:%errorlevel%
)
echo.
pause
実行結果
RDSを開始できました。
![実行結果①](https://batch-file.net/wp-content/uploads/2024/03/bat_aws_rds_start_cli_002.png)
![実行結果②(起動中)](https://batch-file.net/wp-content/uploads/2024/03/bat_aws_rds_start_cli_003.png)
![実行結果③(利用可能)](https://batch-file.net/wp-content/uploads/2024/03/bat_aws_rds_start_cli_004.png)
参考①
上記は以下の記事を参考にして作成しました。
参考②
上記で使用した以下の詳細は、公式サイトをご確認ください。
●aws rds start-db-instance