Skip to content

Instantly share code, notes, and snippets.

@froop
Last active November 29, 2021 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save froop/b266d77dd8c229987cd27a4386d3fc98 to your computer and use it in GitHub Desktop.
Save froop/b266d77dd8c229987cd27a4386d3fc98 to your computer and use it in GitHub Desktop.
[AWS][Windows] Start EC2 instance
cd %TEMP%
aws ec2 describe-instances --instance-ids %AWS_EC2_INSTANCE% --output text --query "Reservations[].Instances[].{PublicIp:PublicIpAddress}" > AWS_EC2_IP.txt
set /P TEMP_IP=<AWS_EC2_IP.txt
del AWS_EC2_IP.txt
setx AWS_EC2_IP %TEMP_IP%
pause
aws ec2 start-instances --instance-ids %AWS_EC2_INSTANCE% && aws ec2 wait instance-running --instance-ids %AWS_EC2_INSTANCE%
pause
aws ec2 stop-instances --instance-ids %AWS_EC2_INSTANCE%
pause
@froop
Copy link
Author

froop commented Nov 29, 2021

update
[AWS][Windows] Launch EC2 instance from template
https://gist.github.com/froop/e2d231a02d6a7be8c2b337378da791ea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment