
バッチファイルから
・EC2インスタンスを開始
できます!
※「起動」ではなく「開始」です!
前提
AWS CLIがインストールされていること。
コード
ここでは例として
・EC2インスタンス「i-xxxxxxxxxxxxxxxxx」を開始
します。

@echo off
rem EC2のインスタンスID
set ec2InstanceId=i-xxxxxxxxxxxxxxxxx
rem プロファイル名
set profile=develop
rem EC2インスタンスを開始
aws ec2 start-instances --instance-ids %ec2InstanceId% --profile %profile% > nul
rem 実行結果を確認
if %errorlevel% == 0 (
echo 正常終了しました。戻り値:%errorlevel%
) else (
echo 異常終了しました。戻り値:%errorlevel%
)
echo.
pause
実行結果
EC2インスタンスを開始できました。


参考①
上記は以下の記事を参考にして作成しました。
参考②
上記で使用した以下の詳細は、公式サイトをご確認ください。
●aws ec2 start-instances